OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/shell/browser/shell_content_browser_client.h" | 5 #include "extensions/shell/browser/shell_content_browser_client.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "content/public/browser/browser_thread.h" | 8 #include "content/public/browser/browser_thread.h" |
9 #include "content/public/browser/render_process_host.h" | 9 #include "content/public/browser/render_process_host.h" |
10 #include "content/public/browser/site_instance.h" | 10 #include "content/public/browser/site_instance.h" |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 BrowserThread::IO, | 178 BrowserThread::IO, |
179 FROM_HERE, | 179 FROM_HERE, |
180 base::Bind(&InfoMap::UnregisterExtensionProcess, | 180 base::Bind(&InfoMap::UnregisterExtensionProcess, |
181 browser_main_parts_->extension_system()->info_map(), | 181 browser_main_parts_->extension_system()->info_map(), |
182 extension->id(), | 182 extension->id(), |
183 site_instance->GetProcess()->GetID(), | 183 site_instance->GetProcess()->GetID(), |
184 site_instance->GetId())); | 184 site_instance->GetId())); |
185 } | 185 } |
186 | 186 |
187 void ShellContentBrowserClient::AppendExtraCommandLineSwitches( | 187 void ShellContentBrowserClient::AppendExtraCommandLineSwitches( |
188 CommandLine* command_line, | 188 base::CommandLine* command_line, |
189 int child_process_id) { | 189 int child_process_id) { |
190 std::string process_type = | 190 std::string process_type = |
191 command_line->GetSwitchValueASCII(::switches::kProcessType); | 191 command_line->GetSwitchValueASCII(::switches::kProcessType); |
192 if (process_type == ::switches::kRendererProcess) | 192 if (process_type == ::switches::kRendererProcess) |
193 AppendRendererSwitches(command_line); | 193 AppendRendererSwitches(command_line); |
194 } | 194 } |
195 | 195 |
196 content::SpeechRecognitionManagerDelegate* | 196 content::SpeechRecognitionManagerDelegate* |
197 ShellContentBrowserClient::CreateSpeechRecognitionManagerDelegate() { | 197 ShellContentBrowserClient::CreateSpeechRecognitionManagerDelegate() { |
198 return new speech::ShellSpeechRecognitionManagerDelegate(); | 198 return new speech::ShellSpeechRecognitionManagerDelegate(); |
(...skipping 29 matching lines...) Expand all Loading... |
228 return new content::ShellDevToolsManagerDelegate(GetBrowserContext()); | 228 return new content::ShellDevToolsManagerDelegate(GetBrowserContext()); |
229 } | 229 } |
230 | 230 |
231 ShellBrowserMainParts* ShellContentBrowserClient::CreateShellBrowserMainParts( | 231 ShellBrowserMainParts* ShellContentBrowserClient::CreateShellBrowserMainParts( |
232 const content::MainFunctionParams& parameters, | 232 const content::MainFunctionParams& parameters, |
233 ShellBrowserMainDelegate* browser_main_delegate) { | 233 ShellBrowserMainDelegate* browser_main_delegate) { |
234 return new ShellBrowserMainParts(parameters, browser_main_delegate); | 234 return new ShellBrowserMainParts(parameters, browser_main_delegate); |
235 } | 235 } |
236 | 236 |
237 void ShellContentBrowserClient::AppendRendererSwitches( | 237 void ShellContentBrowserClient::AppendRendererSwitches( |
238 CommandLine* command_line) { | 238 base::CommandLine* command_line) { |
239 // TODO(jamescook): Should we check here if the process is in the extension | 239 // TODO(jamescook): Should we check here if the process is in the extension |
240 // service process map, or can we assume all renderers are extension | 240 // service process map, or can we assume all renderers are extension |
241 // renderers? | 241 // renderers? |
242 command_line->AppendSwitch(switches::kExtensionProcess); | 242 command_line->AppendSwitch(switches::kExtensionProcess); |
243 | 243 |
244 #if !defined(DISABLE_NACL) | 244 #if !defined(DISABLE_NACL) |
245 // NOTE: app_shell does not support non-SFI mode, so it does not pass through | 245 // NOTE: app_shell does not support non-SFI mode, so it does not pass through |
246 // SFI switches either here or for the zygote process. | 246 // SFI switches either here or for the zygote process. |
247 static const char* const kSwitchNames[] = { | 247 static const char* const kSwitchNames[] = { |
248 ::switches::kEnableNaClDebug, | 248 ::switches::kEnableNaClDebug, |
249 }; | 249 }; |
250 command_line->CopySwitchesFrom(*CommandLine::ForCurrentProcess(), | 250 command_line->CopySwitchesFrom(*base::CommandLine::ForCurrentProcess(), |
251 kSwitchNames, | 251 kSwitchNames, arraysize(kSwitchNames)); |
252 arraysize(kSwitchNames)); | |
253 #endif // !defined(DISABLE_NACL) | 252 #endif // !defined(DISABLE_NACL) |
254 } | 253 } |
255 | 254 |
256 const Extension* ShellContentBrowserClient::GetExtension( | 255 const Extension* ShellContentBrowserClient::GetExtension( |
257 content::SiteInstance* site_instance) { | 256 content::SiteInstance* site_instance) { |
258 ExtensionRegistry* registry = | 257 ExtensionRegistry* registry = |
259 ExtensionRegistry::Get(site_instance->GetBrowserContext()); | 258 ExtensionRegistry::Get(site_instance->GetBrowserContext()); |
260 return registry->enabled_extensions().GetExtensionOrAppByURL( | 259 return registry->enabled_extensions().GetExtensionOrAppByURL( |
261 site_instance->GetSiteURL()); | 260 site_instance->GetSiteURL()); |
262 } | 261 } |
263 | 262 |
264 } // namespace extensions | 263 } // namespace extensions |
OLD | NEW |