Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: apps/shell/browser/shell_content_browser_client.cc

Issue 282103004: Rename ProtocolInterceptJobFactory and make it not use ProtocolHandlers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Response to jam's comments (And a merge) Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/browser/shell_content_browser_client.h" 5 #include "apps/shell/browser/shell_content_browser_client.h"
6 6
7 #include "apps/shell/browser/shell_browser_context.h" 7 #include "apps/shell/browser/shell_browser_context.h"
8 #include "apps/shell/browser/shell_browser_main_parts.h" 8 #include "apps/shell/browser/shell_browser_main_parts.h"
9 #include "apps/shell/browser/shell_extension_system.h" 9 #include "apps/shell/browser/shell_extension_system.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 // This ensures that all render views created for a single app will use the 72 // This ensures that all render views created for a single app will use the
73 // same render process (see content::SiteInstance::GetProcess). Otherwise the 73 // same render process (see content::SiteInstance::GetProcess). Otherwise the
74 // default behavior of ContentBrowserClient will lead to separate render 74 // default behavior of ContentBrowserClient will lead to separate render
75 // processes for the background page and each app window view. 75 // processes for the background page and each app window view.
76 return true; 76 return true;
77 } 77 }
78 78
79 net::URLRequestContextGetter* ShellContentBrowserClient::CreateRequestContext( 79 net::URLRequestContextGetter* ShellContentBrowserClient::CreateRequestContext(
80 content::BrowserContext* content_browser_context, 80 content::BrowserContext* content_browser_context,
81 content::ProtocolHandlerMap* protocol_handlers, 81 content::ProtocolHandlerMap* protocol_handlers,
82 content::ProtocolHandlerScopedVector protocol_interceptors) { 82 content::URLRequestInterceptorScopedVector request_interceptors) {
83 // Handle only chrome-extension:// requests. app_shell does not support 83 // Handle only chrome-extension:// requests. app_shell does not support
84 // chrome-extension-resource:// requests (it does not store shared extension 84 // chrome-extension-resource:// requests (it does not store shared extension
85 // data in its installation directory). 85 // data in its installation directory).
86 extensions::InfoMap* extension_info_map = 86 extensions::InfoMap* extension_info_map =
87 browser_main_parts_->extension_system()->info_map(); 87 browser_main_parts_->extension_system()->info_map();
88 (*protocol_handlers)[extensions::kExtensionScheme] = 88 (*protocol_handlers)[extensions::kExtensionScheme] =
89 linked_ptr<net::URLRequestJobFactory::ProtocolHandler>( 89 linked_ptr<net::URLRequestJobFactory::ProtocolHandler>(
90 extensions::CreateExtensionProtocolHandler(false /* is_incognito */, 90 extensions::CreateExtensionProtocolHandler(false /* is_incognito */,
91 extension_info_map)); 91 extension_info_map));
92 // Let content::ShellBrowserContext handle the rest of the setup. 92 // Let content::ShellBrowserContext handle the rest of the setup.
93 return browser_main_parts_->browser_context()->CreateRequestContext( 93 return browser_main_parts_->browser_context()->CreateRequestContext(
94 protocol_handlers, protocol_interceptors.Pass()); 94 protocol_handlers, request_interceptors.Pass());
95 } 95 }
96 96
97 bool ShellContentBrowserClient::IsHandledURL(const GURL& url) { 97 bool ShellContentBrowserClient::IsHandledURL(const GURL& url) {
98 if (!url.is_valid()) 98 if (!url.is_valid())
99 return false; 99 return false;
100 // Keep in sync with ProtocolHandlers added in CreateRequestContext() and in 100 // Keep in sync with ProtocolHandlers added in CreateRequestContext() and in
101 // content::ShellURLRequestContextGetter::GetURLRequestContext(). 101 // content::ShellURLRequestContextGetter::GetURLRequestContext().
102 static const char* const kProtocolList[] = { 102 static const char* const kProtocolList[] = {
103 url::kBlobScheme, 103 url::kBlobScheme,
104 content::kChromeDevToolsScheme, 104 content::kChromeDevToolsScheme,
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 181
182 const extensions::Extension* ShellContentBrowserClient::GetExtension( 182 const extensions::Extension* ShellContentBrowserClient::GetExtension(
183 content::SiteInstance* site_instance) { 183 content::SiteInstance* site_instance) {
184 ExtensionRegistry* registry = 184 ExtensionRegistry* registry =
185 ExtensionRegistry::Get(site_instance->GetBrowserContext()); 185 ExtensionRegistry::Get(site_instance->GetBrowserContext());
186 return registry->enabled_extensions().GetExtensionOrAppByURL( 186 return registry->enabled_extensions().GetExtensionOrAppByURL(
187 site_instance->GetSiteURL()); 187 site_instance->GetSiteURL());
188 } 188 }
189 189
190 } // namespace apps 190 } // namespace apps
OLDNEW
« no previous file with comments | « apps/shell/browser/shell_content_browser_client.h ('k') | ash/shell/content_client/shell_content_browser_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698