| 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 "apps/shell/shell_content_browser_client.h" | 5 #include "apps/shell/shell_content_browser_client.h" |
| 6 | 6 |
| 7 #include "apps/shell/shell_browser_context.h" | 7 #include "apps/shell/shell_browser_context.h" |
| 8 #include "apps/shell/shell_browser_main_parts.h" | 8 #include "apps/shell/shell_browser_main_parts.h" |
| 9 #include "apps/shell/shell_extension_system.h" | 9 #include "apps/shell/shell_extension_system.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "chrome/browser/extensions/extension_protocols.h" | 11 #include "chrome/browser/extensions/extension_protocols.h" |
| 12 #include "chrome/browser/extensions/extension_resource_protocols.h" | 12 #include "chrome/browser/extensions/extension_resource_protocols.h" |
| 13 #include "chrome/common/chrome_switches.h" | |
| 14 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
| 15 #include "content/public/browser/render_process_host.h" | 14 #include "content/public/browser/render_process_host.h" |
| 16 #include "content/public/browser/site_instance.h" | 15 #include "content/public/browser/site_instance.h" |
| 17 #include "content/public/common/content_switches.h" | 16 #include "content/public/common/content_switches.h" |
| 18 #include "content/public/common/url_constants.h" | 17 #include "content/public/common/url_constants.h" |
| 19 #include "content/shell/browser/shell_browser_context.h" | 18 #include "content/shell/browser/shell_browser_context.h" |
| 20 #include "extensions/browser/extension_registry.h" | 19 #include "extensions/browser/extension_registry.h" |
| 21 #include "extensions/browser/info_map.h" | 20 #include "extensions/browser/info_map.h" |
| 22 #include "extensions/common/constants.h" | 21 #include "extensions/common/constants.h" |
| 23 #include "extensions/common/extension.h" | 22 #include "extensions/common/extension.h" |
| 23 #include "extensions/common/switches.h" |
| 24 #include "url/gurl.h" | 24 #include "url/gurl.h" |
| 25 | 25 |
| 26 using content::BrowserThread; | 26 using content::BrowserThread; |
| 27 using extensions::ExtensionRegistry; | 27 using extensions::ExtensionRegistry; |
| 28 | 28 |
| 29 namespace apps { | 29 namespace apps { |
| 30 | 30 |
| 31 ShellContentBrowserClient::ShellContentBrowserClient() | 31 ShellContentBrowserClient::ShellContentBrowserClient() |
| 32 : browser_main_parts_(NULL) { | 32 : browser_main_parts_(NULL) { |
| 33 } | 33 } |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 } | 121 } |
| 122 | 122 |
| 123 void ShellContentBrowserClient::AppendExtraCommandLineSwitches( | 123 void ShellContentBrowserClient::AppendExtraCommandLineSwitches( |
| 124 CommandLine* command_line, int child_process_id) { | 124 CommandLine* command_line, int child_process_id) { |
| 125 std::string process_type = | 125 std::string process_type = |
| 126 command_line->GetSwitchValueASCII(switches::kProcessType); | 126 command_line->GetSwitchValueASCII(switches::kProcessType); |
| 127 if (process_type == switches::kRendererProcess) { | 127 if (process_type == switches::kRendererProcess) { |
| 128 // TODO(jamescook): Should we check here if the process is in the extension | 128 // TODO(jamescook): Should we check here if the process is in the extension |
| 129 // service process map, or can we assume all renderers are extension | 129 // service process map, or can we assume all renderers are extension |
| 130 // renderers? | 130 // renderers? |
| 131 command_line->AppendSwitch(switches::kExtensionProcess); | 131 command_line->AppendSwitch(extensions::switches::kExtensionProcess); |
| 132 } | 132 } |
| 133 } | 133 } |
| 134 | 134 |
| 135 const extensions::Extension* ShellContentBrowserClient::GetExtension( | 135 const extensions::Extension* ShellContentBrowserClient::GetExtension( |
| 136 content::SiteInstance* site_instance) { | 136 content::SiteInstance* site_instance) { |
| 137 ExtensionRegistry* registry = | 137 ExtensionRegistry* registry = |
| 138 ExtensionRegistry::Get(site_instance->GetBrowserContext()); | 138 ExtensionRegistry::Get(site_instance->GetBrowserContext()); |
| 139 return registry->enabled_extensions().GetExtensionOrAppByURL( | 139 return registry->enabled_extensions().GetExtensionOrAppByURL( |
| 140 site_instance->GetSiteURL()); | 140 site_instance->GetSiteURL()); |
| 141 } | 141 } |
| 142 | 142 |
| 143 } // namespace apps | 143 } // namespace apps |
| OLD | NEW |