| Index: extensions/shell/browser/shell_content_browser_client.cc
|
| diff --git a/apps/shell/browser/shell_content_browser_client.cc b/extensions/shell/browser/shell_content_browser_client.cc
|
| similarity index 79%
|
| rename from apps/shell/browser/shell_content_browser_client.cc
|
| rename to extensions/shell/browser/shell_content_browser_client.cc
|
| index 5dfc3171e54e858df396bcb04f7be2603b82cf6b..1b48b56e122e35c8e4d4528568d8224e0aea276f 100644
|
| --- a/apps/shell/browser/shell_content_browser_client.cc
|
| +++ b/extensions/shell/browser/shell_content_browser_client.cc
|
| @@ -2,11 +2,8 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "apps/shell/browser/shell_content_browser_client.h"
|
| +#include "extensions/shell/browser/shell_content_browser_client.h"
|
|
|
| -#include "apps/shell/browser/shell_browser_context.h"
|
| -#include "apps/shell/browser/shell_browser_main_parts.h"
|
| -#include "apps/shell/browser/shell_extension_system.h"
|
| #include "base/command_line.h"
|
| #include "content/public/browser/browser_thread.h"
|
| #include "content/public/browser/render_process_host.h"
|
| @@ -22,12 +19,14 @@
|
| #include "extensions/common/constants.h"
|
| #include "extensions/common/extension.h"
|
| #include "extensions/common/switches.h"
|
| +#include "extensions/shell/browser/shell_browser_context.h"
|
| +#include "extensions/shell/browser/shell_browser_main_parts.h"
|
| +#include "extensions/shell/browser/shell_extension_system.h"
|
| #include "url/gurl.h"
|
|
|
| using content::BrowserThread;
|
| -using extensions::ExtensionRegistry;
|
|
|
| -namespace apps {
|
| +namespace extensions {
|
| namespace {
|
|
|
| ShellContentBrowserClient* g_instance = NULL;
|
| @@ -41,7 +40,9 @@ ShellContentBrowserClient::ShellContentBrowserClient(
|
| g_instance = this;
|
| }
|
|
|
| -ShellContentBrowserClient::~ShellContentBrowserClient() { g_instance = NULL; }
|
| +ShellContentBrowserClient::~ShellContentBrowserClient() {
|
| + g_instance = NULL;
|
| +}
|
|
|
| // static
|
| ShellContentBrowserClient* ShellContentBrowserClient::Get() {
|
| @@ -62,7 +63,7 @@ content::BrowserMainParts* ShellContentBrowserClient::CreateBrowserMainParts(
|
| void ShellContentBrowserClient::RenderProcessWillLaunch(
|
| content::RenderProcessHost* host) {
|
| int render_process_id = host->GetID();
|
| - host->AddFilter(new extensions::ExtensionMessageFilter(
|
| + host->AddFilter(new ExtensionMessageFilter(
|
| render_process_id, browser_main_parts_->browser_context()));
|
| }
|
|
|
| @@ -83,12 +84,12 @@ net::URLRequestContextGetter* ShellContentBrowserClient::CreateRequestContext(
|
| // Handle only chrome-extension:// requests. app_shell does not support
|
| // chrome-extension-resource:// requests (it does not store shared extension
|
| // data in its installation directory).
|
| - extensions::InfoMap* extension_info_map =
|
| + InfoMap* extension_info_map =
|
| browser_main_parts_->extension_system()->info_map();
|
| - (*protocol_handlers)[extensions::kExtensionScheme] =
|
| + (*protocol_handlers)[kExtensionScheme] =
|
| linked_ptr<net::URLRequestJobFactory::ProtocolHandler>(
|
| - extensions::CreateExtensionProtocolHandler(false /* is_incognito */,
|
| - extension_info_map));
|
| + CreateExtensionProtocolHandler(false /* is_incognito */,
|
| + extension_info_map));
|
| // Let content::ShellBrowserContext handle the rest of the setup.
|
| return browser_main_parts_->browser_context()->CreateRequestContext(
|
| protocol_handlers, request_interceptors.Pass());
|
| @@ -106,8 +107,8 @@ bool ShellContentBrowserClient::IsHandledURL(const GURL& url) {
|
| url::kDataScheme,
|
| url::kFileScheme,
|
| url::kFileSystemScheme,
|
| - extensions::kExtensionScheme,
|
| - extensions::kExtensionResourceScheme,
|
| + kExtensionScheme,
|
| + kExtensionResourceScheme,
|
| };
|
| for (size_t i = 0; i < arraysize(kProtocolList); ++i) {
|
| if (url.scheme() == kProtocolList[i])
|
| @@ -119,11 +120,11 @@ bool ShellContentBrowserClient::IsHandledURL(const GURL& url) {
|
| void ShellContentBrowserClient::SiteInstanceGotProcess(
|
| content::SiteInstance* site_instance) {
|
| // If this isn't an extension renderer there's nothing to do.
|
| - const extensions::Extension* extension = GetExtension(site_instance);
|
| + const Extension* extension = GetExtension(site_instance);
|
| if (!extension)
|
| return;
|
|
|
| - extensions::ProcessMap::Get(browser_main_parts_->browser_context())
|
| + ProcessMap::Get(browser_main_parts_->browser_context())
|
| ->Insert(extension->id(),
|
| site_instance->GetProcess()->GetID(),
|
| site_instance->GetId());
|
| @@ -131,7 +132,7 @@ void ShellContentBrowserClient::SiteInstanceGotProcess(
|
| BrowserThread::PostTask(
|
| BrowserThread::IO,
|
| FROM_HERE,
|
| - base::Bind(&extensions::InfoMap::RegisterExtensionProcess,
|
| + base::Bind(&InfoMap::RegisterExtensionProcess,
|
| browser_main_parts_->extension_system()->info_map(),
|
| extension->id(),
|
| site_instance->GetProcess()->GetID(),
|
| @@ -141,11 +142,11 @@ void ShellContentBrowserClient::SiteInstanceGotProcess(
|
| void ShellContentBrowserClient::SiteInstanceDeleting(
|
| content::SiteInstance* site_instance) {
|
| // If this isn't an extension renderer there's nothing to do.
|
| - const extensions::Extension* extension = GetExtension(site_instance);
|
| + const Extension* extension = GetExtension(site_instance);
|
| if (!extension)
|
| return;
|
|
|
| - extensions::ProcessMap::Get(browser_main_parts_->browser_context())
|
| + ProcessMap::Get(browser_main_parts_->browser_context())
|
| ->Remove(extension->id(),
|
| site_instance->GetProcess()->GetID(),
|
| site_instance->GetId());
|
| @@ -153,7 +154,7 @@ void ShellContentBrowserClient::SiteInstanceDeleting(
|
| BrowserThread::PostTask(
|
| BrowserThread::IO,
|
| FROM_HERE,
|
| - base::Bind(&extensions::InfoMap::UnregisterExtensionProcess,
|
| + base::Bind(&InfoMap::UnregisterExtensionProcess,
|
| browser_main_parts_->extension_system()->info_map(),
|
| extension->id(),
|
| site_instance->GetProcess()->GetID(),
|
| @@ -161,14 +162,15 @@ void ShellContentBrowserClient::SiteInstanceDeleting(
|
| }
|
|
|
| void ShellContentBrowserClient::AppendExtraCommandLineSwitches(
|
| - CommandLine* command_line, int child_process_id) {
|
| + CommandLine* command_line,
|
| + int child_process_id) {
|
| std::string process_type =
|
| - command_line->GetSwitchValueASCII(switches::kProcessType);
|
| - if (process_type == switches::kRendererProcess) {
|
| + command_line->GetSwitchValueASCII(::switches::kProcessType);
|
| + if (process_type == ::switches::kRendererProcess) {
|
| // TODO(jamescook): Should we check here if the process is in the extension
|
| // service process map, or can we assume all renderers are extension
|
| // renderers?
|
| - command_line->AppendSwitch(extensions::switches::kExtensionProcess);
|
| + command_line->AppendSwitch(switches::kExtensionProcess);
|
| }
|
| }
|
|
|
| @@ -176,10 +178,10 @@ void ShellContentBrowserClient::GetAdditionalAllowedSchemesForFileSystem(
|
| std::vector<std::string>* additional_allowed_schemes) {
|
| ContentBrowserClient::GetAdditionalAllowedSchemesForFileSystem(
|
| additional_allowed_schemes);
|
| - additional_allowed_schemes->push_back(extensions::kExtensionScheme);
|
| + additional_allowed_schemes->push_back(kExtensionScheme);
|
| }
|
|
|
| -const extensions::Extension* ShellContentBrowserClient::GetExtension(
|
| +const Extension* ShellContentBrowserClient::GetExtension(
|
| content::SiteInstance* site_instance) {
|
| ExtensionRegistry* registry =
|
| ExtensionRegistry::Get(site_instance->GetBrowserContext());
|
| @@ -187,4 +189,4 @@ const extensions::Extension* ShellContentBrowserClient::GetExtension(
|
| site_instance->GetSiteURL());
|
| }
|
|
|
| -} // namespace apps
|
| +} // namespace extensions
|
|
|