OLD | NEW |
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" |
11 #include "chrome/common/extensions/extension_messages.h" | |
12 #include "content/public/browser/notification_service.h" | 11 #include "content/public/browser/notification_service.h" |
13 #include "content/public/browser/render_view_host.h" | 12 #include "content/public/browser/render_view_host.h" |
14 #include "content/public/browser/web_contents.h" | 13 #include "content/public/browser/web_contents.h" |
| 14 #include "extensions/common/extension_messages.h" |
15 | 15 |
16 DEFINE_WEB_CONTENTS_USER_DATA_KEY(SessionTabHelper); | 16 DEFINE_WEB_CONTENTS_USER_DATA_KEY(SessionTabHelper); |
17 | 17 |
18 SessionTabHelper::SessionTabHelper(content::WebContents* contents) | 18 SessionTabHelper::SessionTabHelper(content::WebContents* contents) |
19 : content::WebContentsObserver(contents) { | 19 : content::WebContentsObserver(contents) { |
20 } | 20 } |
21 | 21 |
22 SessionTabHelper::~SessionTabHelper() { | 22 SessionTabHelper::~SessionTabHelper() { |
23 } | 23 } |
24 | 24 |
(...skipping 16 matching lines...) Expand all Loading... |
41 | 41 |
42 void SessionTabHelper::UserAgentOverrideSet(const std::string& user_agent) { | 42 void SessionTabHelper::UserAgentOverrideSet(const std::string& user_agent) { |
43 #if defined(ENABLE_SESSION_SERVICE) | 43 #if defined(ENABLE_SESSION_SERVICE) |
44 Profile* profile = | 44 Profile* profile = |
45 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); | 45 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); |
46 SessionService* session = SessionServiceFactory::GetForProfile(profile); | 46 SessionService* session = SessionServiceFactory::GetForProfile(profile); |
47 if (session) | 47 if (session) |
48 session->SetTabUserAgentOverride(window_id(), session_id(), user_agent); | 48 session->SetTabUserAgentOverride(window_id(), session_id(), user_agent); |
49 #endif | 49 #endif |
50 } | 50 } |
OLD | NEW |