OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/extensions/chrome_extensions_browser_client.h" | 5 #include "chrome/browser/extensions/chrome_extensions_browser_client.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/version.h" | 8 #include "base/version.h" |
9 #include "chrome/browser/app_mode/app_mode_utils.h" | 9 #include "chrome/browser/app_mode/app_mode_utils.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 #else | 113 #else |
114 // There are no browser windows open and the browser process was | 114 // There are no browser windows open and the browser process was |
115 // started to show the app launcher. | 115 // started to show the app launcher. |
116 return chrome::GetTotalBrowserCountForProfile(profile) == 0 && | 116 return chrome::GetTotalBrowserCountForProfile(profile) == 0 && |
117 CommandLine::ForCurrentProcess()->HasSwitch(switches::kShowAppList); | 117 CommandLine::ForCurrentProcess()->HasSwitch(switches::kShowAppList); |
118 #endif | 118 #endif |
119 } | 119 } |
120 | 120 |
121 bool ChromeExtensionsBrowserClient::IsBackgroundPageAllowed( | 121 bool ChromeExtensionsBrowserClient::IsBackgroundPageAllowed( |
122 content::BrowserContext* context) const { | 122 content::BrowserContext* context) const { |
123 #if defined(OS_CHROMEOS) | 123 // Returns true if current session is Guest mode session and current |
124 // Returns true if current session is Chrome OS Guest mode session and current | |
125 // browser context is *not* off-the-record. Such context is artificial and | 124 // browser context is *not* off-the-record. Such context is artificial and |
126 // background page shouldn't be created in it. | 125 // background page shouldn't be created in it. |
127 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 126 return !static_cast<Profile*>(context)->IsGuestSession() || |
128 if (command_line->HasSwitch(chromeos::switches::kGuestSession) && | 127 context->IsOffTheRecord(); |
129 !context->IsOffTheRecord()) { | |
130 return false; | |
131 } | |
132 #endif | |
133 return true; | |
134 } | 128 } |
135 | 129 |
136 void ChromeExtensionsBrowserClient::OnExtensionHostCreated( | 130 void ChromeExtensionsBrowserClient::OnExtensionHostCreated( |
137 content::WebContents* web_contents) { | 131 content::WebContents* web_contents) { |
138 PrefsTabHelper::CreateForWebContents(web_contents); | 132 PrefsTabHelper::CreateForWebContents(web_contents); |
139 } | 133 } |
140 | 134 |
141 void ChromeExtensionsBrowserClient::OnRenderViewCreatedForBackgroundPage( | 135 void ChromeExtensionsBrowserClient::OnRenderViewCreatedForBackgroundPage( |
142 ExtensionHost* host) { | 136 ExtensionHost* host) { |
143 ExtensionService* service = | 137 ExtensionService* service = |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 dependencies.push_back(ExtensionSystemSharedFactory::GetInstance()); | 198 dependencies.push_back(ExtensionSystemSharedFactory::GetInstance()); |
205 return dependencies; | 199 return dependencies; |
206 } | 200 } |
207 | 201 |
208 ExtensionSystem* ChromeExtensionsBrowserClient::CreateExtensionSystem( | 202 ExtensionSystem* ChromeExtensionsBrowserClient::CreateExtensionSystem( |
209 content::BrowserContext* context) { | 203 content::BrowserContext* context) { |
210 return new ExtensionSystemImpl(static_cast<Profile*>(context)); | 204 return new ExtensionSystemImpl(static_cast<Profile*>(context)); |
211 } | 205 } |
212 | 206 |
213 } // namespace extensions | 207 } // namespace extensions |
OLD | NEW |