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 if ((static_cast<Profile*>(context))->IsGuestSession() && |
msw
2014/02/15 00:30:52
nit: convert this if statement and following retur
bcwhite
2014/02/18 15:19:36
Done.
| |
128 if (command_line->HasSwitch(chromeos::switches::kGuestSession) && | |
129 !context->IsOffTheRecord()) { | 127 !context->IsOffTheRecord()) { |
130 return false; | 128 return false; |
131 } | 129 } |
132 #endif | 130 |
133 return true; | 131 return true; |
134 } | 132 } |
135 | 133 |
136 void ChromeExtensionsBrowserClient::OnExtensionHostCreated( | 134 void ChromeExtensionsBrowserClient::OnExtensionHostCreated( |
137 content::WebContents* web_contents) { | 135 content::WebContents* web_contents) { |
138 PrefsTabHelper::CreateForWebContents(web_contents); | 136 PrefsTabHelper::CreateForWebContents(web_contents); |
139 } | 137 } |
140 | 138 |
141 void ChromeExtensionsBrowserClient::OnRenderViewCreatedForBackgroundPage( | 139 void ChromeExtensionsBrowserClient::OnRenderViewCreatedForBackgroundPage( |
142 ExtensionHost* host) { | 140 ExtensionHost* host) { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
204 dependencies.push_back(ExtensionSystemSharedFactory::GetInstance()); | 202 dependencies.push_back(ExtensionSystemSharedFactory::GetInstance()); |
205 return dependencies; | 203 return dependencies; |
206 } | 204 } |
207 | 205 |
208 ExtensionSystem* ChromeExtensionsBrowserClient::CreateExtensionSystem( | 206 ExtensionSystem* ChromeExtensionsBrowserClient::CreateExtensionSystem( |
209 content::BrowserContext* context) { | 207 content::BrowserContext* context) { |
210 return new ExtensionSystemImpl(static_cast<Profile*>(context)); | 208 return new ExtensionSystemImpl(static_cast<Profile*>(context)); |
211 } | 209 } |
212 | 210 |
213 } // namespace extensions | 211 } // namespace extensions |
OLD | NEW |