X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fchrome%2Fbrowser%2Fsessions%2Fsession_tab_helper.cc;h=467ed22d5f67c0beb13f6c5c6343a144e6c395ec;hb=3545e9f2671f595d2a2f3ee75ca0393b01e35ef6;hp=8435649f2385d162062312dc6cc9be7b67e9f671;hpb=7d210d4c7e9ba36e635eabc5b5780495f8a63292;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/chrome/browser/sessions/session_tab_helper.cc b/src/chrome/browser/sessions/session_tab_helper.cc index 8435649..467ed22 100644 --- a/src/chrome/browser/sessions/session_tab_helper.cc +++ b/src/chrome/browser/sessions/session_tab_helper.cc @@ -11,7 +11,10 @@ #include "content/public/browser/notification_service.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/web_contents.h" + +#if defined(ENABLE_EXTENSIONS) #include "extensions/common/extension_messages.h" +#endif DEFINE_WEB_CONTENTS_USER_DATA_KEY(SessionTabHelper); @@ -25,19 +28,38 @@ SessionTabHelper::~SessionTabHelper() { void SessionTabHelper::SetWindowID(const SessionID& id) { window_id_ = id; +#if defined(ENABLE_EXTENSIONS) // Extension code in the renderer holds the ID of the window that hosts it. // Notify it that the window ID changed. web_contents()->GetRenderViewHost()->Send( new ExtensionMsg_UpdateBrowserWindowId( web_contents()->GetRenderViewHost()->GetRoutingID(), id.id())); +#endif +} + +// static +SessionID::id_type SessionTabHelper::IdForTab(const content::WebContents* tab) { + const SessionTabHelper* session_tab_helper = + tab ? SessionTabHelper::FromWebContents(tab) : NULL; + return session_tab_helper ? session_tab_helper->session_id().id() : -1; +} + +// static +SessionID::id_type SessionTabHelper::IdForWindowContainingTab( + const content::WebContents* tab) { + const SessionTabHelper* session_tab_helper = + tab ? SessionTabHelper::FromWebContents(tab) : NULL; + return session_tab_helper ? session_tab_helper->window_id().id() : -1; } +#if defined(ENABLE_EXTENSIONS) void SessionTabHelper::RenderViewCreated( content::RenderViewHost* render_view_host) { render_view_host->Send( new ExtensionMsg_UpdateBrowserWindowId(render_view_host->GetRoutingID(), window_id_.id())); } +#endif void SessionTabHelper::UserAgentOverrideSet(const std::string& user_agent) { #if defined(ENABLE_SESSION_SERVICE)