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

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

Issue 2468723003: Move session service and supervised users to buildflags. (Closed)
Patch Set: Created 4 years, 1 month 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
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/profiles/profile.h" 7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/sessions/session_service.h" 8 #include "chrome/browser/sessions/session_service.h"
9 #include "chrome/browser/sessions/session_service_factory.h" 9 #include "chrome/browser/sessions/session_service_factory.h"
10 #include "chrome/common/features.h"
10 #include "content/public/browser/web_contents.h" 11 #include "content/public/browser/web_contents.h"
11 12
12 #if defined(ENABLE_EXTENSIONS) 13 #if defined(ENABLE_EXTENSIONS)
13 #include "extensions/common/extension_messages.h" 14 #include "extensions/common/extension_messages.h"
14 #endif 15 #endif
15 16
16 DEFINE_WEB_CONTENTS_USER_DATA_KEY(SessionTabHelper); 17 DEFINE_WEB_CONTENTS_USER_DATA_KEY(SessionTabHelper);
17 18
18 SessionTabHelper::SessionTabHelper(content::WebContents* contents) 19 SessionTabHelper::SessionTabHelper(content::WebContents* contents)
19 : content::WebContentsObserver(contents) { 20 : content::WebContentsObserver(contents) {
(...skipping 22 matching lines...) Expand all
42 43
43 // static 44 // static
44 SessionID::id_type SessionTabHelper::IdForWindowContainingTab( 45 SessionID::id_type SessionTabHelper::IdForWindowContainingTab(
45 const content::WebContents* tab) { 46 const content::WebContents* tab) {
46 const SessionTabHelper* session_tab_helper = 47 const SessionTabHelper* session_tab_helper =
47 tab ? SessionTabHelper::FromWebContents(tab) : NULL; 48 tab ? SessionTabHelper::FromWebContents(tab) : NULL;
48 return session_tab_helper ? session_tab_helper->window_id().id() : -1; 49 return session_tab_helper ? session_tab_helper->window_id().id() : -1;
49 } 50 }
50 51
51 void SessionTabHelper::UserAgentOverrideSet(const std::string& user_agent) { 52 void SessionTabHelper::UserAgentOverrideSet(const std::string& user_agent) {
52 #if defined(ENABLE_SESSION_SERVICE) 53 #if BUILDFLAG(ENABLE_SESSION_SERVICE)
53 Profile* profile = 54 Profile* profile =
54 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); 55 Profile::FromBrowserContext(web_contents()->GetBrowserContext());
55 SessionService* session = SessionServiceFactory::GetForProfile(profile); 56 SessionService* session = SessionServiceFactory::GetForProfile(profile);
56 if (session) 57 if (session)
57 session->SetTabUserAgentOverride(window_id(), session_id(), user_agent); 58 session->SetTabUserAgentOverride(window_id(), session_id(), user_agent);
58 #endif 59 #endif
59 } 60 }
OLDNEW
« no previous file with comments | « chrome/browser/sessions/chrome_tab_restore_service_client.cc ('k') | chrome/browser/signin/chrome_signin_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698