Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Side by Side Diff: chrome/browser/sessions/session_tab_helper.cc

Issue 480883002: Move session_id.{cc,h} from chrome/browser/sessions to components/sessions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/sessions/session_tab_helper.h ('k') | chrome/browser/sessions/session_types.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/sessions/session_tab_helper.h" 5 #include "chrome/browser/sessions/session_tab_helper.h"
6 6
7 #include "chrome/browser/chrome_notification_types.h" 7 #include "chrome/browser/chrome_notification_types.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/sessions/session_service.h" 9 #include "chrome/browser/sessions/session_service.h"
10 #include "chrome/browser/sessions/session_service_factory.h" 10 #include "chrome/browser/sessions/session_service_factory.h"
(...skipping 14 matching lines...) Expand all
25 void SessionTabHelper::SetWindowID(const SessionID& id) { 25 void SessionTabHelper::SetWindowID(const SessionID& id) {
26 window_id_ = id; 26 window_id_ = id;
27 27
28 // Extension code in the renderer holds the ID of the window that hosts it. 28 // Extension code in the renderer holds the ID of the window that hosts it.
29 // Notify it that the window ID changed. 29 // Notify it that the window ID changed.
30 web_contents()->GetRenderViewHost()->Send( 30 web_contents()->GetRenderViewHost()->Send(
31 new ExtensionMsg_UpdateBrowserWindowId( 31 new ExtensionMsg_UpdateBrowserWindowId(
32 web_contents()->GetRenderViewHost()->GetRoutingID(), id.id())); 32 web_contents()->GetRenderViewHost()->GetRoutingID(), id.id()));
33 } 33 }
34 34
35 // static
36 SessionID::id_type SessionTabHelper::IdForTab(const content::WebContents* tab) {
37 const SessionTabHelper* session_tab_helper =
38 tab ? SessionTabHelper::FromWebContents(tab) : NULL;
39 return session_tab_helper ? session_tab_helper->session_id().id() : -1;
40 }
41
42 // static
43 SessionID::id_type SessionTabHelper::IdForWindowContainingTab(
44 const content::WebContents* tab) {
45 const SessionTabHelper* session_tab_helper =
46 tab ? SessionTabHelper::FromWebContents(tab) : NULL;
47 return session_tab_helper ? session_tab_helper->window_id().id() : -1;
48 }
49
35 void SessionTabHelper::RenderViewCreated( 50 void SessionTabHelper::RenderViewCreated(
36 content::RenderViewHost* render_view_host) { 51 content::RenderViewHost* render_view_host) {
37 render_view_host->Send( 52 render_view_host->Send(
38 new ExtensionMsg_UpdateBrowserWindowId(render_view_host->GetRoutingID(), 53 new ExtensionMsg_UpdateBrowserWindowId(render_view_host->GetRoutingID(),
39 window_id_.id())); 54 window_id_.id()));
40 } 55 }
41 56
42 void SessionTabHelper::UserAgentOverrideSet(const std::string& user_agent) { 57 void SessionTabHelper::UserAgentOverrideSet(const std::string& user_agent) {
43 #if defined(ENABLE_SESSION_SERVICE) 58 #if defined(ENABLE_SESSION_SERVICE)
44 Profile* profile = 59 Profile* profile =
45 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); 60 Profile::FromBrowserContext(web_contents()->GetBrowserContext());
46 SessionService* session = SessionServiceFactory::GetForProfile(profile); 61 SessionService* session = SessionServiceFactory::GetForProfile(profile);
47 if (session) 62 if (session)
48 session->SetTabUserAgentOverride(window_id(), session_id(), user_agent); 63 session->SetTabUserAgentOverride(window_id(), session_id(), user_agent);
49 #endif 64 #endif
50 } 65 }
OLDNEW
« no previous file with comments | « chrome/browser/sessions/session_tab_helper.h ('k') | chrome/browser/sessions/session_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698