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

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

Issue 187223003: Allow content layer to pass ProtocolInterceptors when we create URLRequestContext (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 "content/shell/browser/shell_content_browser_client.h" 5 #include "content/shell/browser/shell_content_browser_client.h"
6 6
7 #include "base/base_switches.h" 7 #include "base/base_switches.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 ->GetDatabaseTracker(), 147 ->GetDatabaseTracker(),
148 BrowserContext::GetDefaultStoragePartition(browser_context()) 148 BrowserContext::GetDefaultStoragePartition(browser_context())
149 ->GetQuotaManager(), 149 ->GetQuotaManager(),
150 BrowserContext::GetDefaultStoragePartition(browser_context()) 150 BrowserContext::GetDefaultStoragePartition(browser_context())
151 ->GetURLRequestContext())); 151 ->GetURLRequestContext()));
152 host->Send(new ShellViewMsg_SetWebKitSourceDir(webkit_source_dir_)); 152 host->Send(new ShellViewMsg_SetWebKitSourceDir(webkit_source_dir_));
153 } 153 }
154 154
155 net::URLRequestContextGetter* ShellContentBrowserClient::CreateRequestContext( 155 net::URLRequestContextGetter* ShellContentBrowserClient::CreateRequestContext(
156 BrowserContext* content_browser_context, 156 BrowserContext* content_browser_context,
157 ProtocolHandlerMap* protocol_handlers) { 157 ProtocolHandlerMap* protocol_handlers,
158 ProtocolHandlerScopedVector protocol_interceptors) {
158 ShellBrowserContext* shell_browser_context = 159 ShellBrowserContext* shell_browser_context =
159 ShellBrowserContextForBrowserContext(content_browser_context); 160 ShellBrowserContextForBrowserContext(content_browser_context);
160 return shell_browser_context->CreateRequestContext(protocol_handlers); 161 return shell_browser_context->CreateRequestContext(
162 protocol_handlers, protocol_interceptors.Pass());
161 } 163 }
162 164
163 net::URLRequestContextGetter* 165 net::URLRequestContextGetter*
164 ShellContentBrowserClient::CreateRequestContextForStoragePartition( 166 ShellContentBrowserClient::CreateRequestContextForStoragePartition(
165 BrowserContext* content_browser_context, 167 BrowserContext* content_browser_context,
166 const base::FilePath& partition_path, 168 const base::FilePath& partition_path,
167 bool in_memory, 169 bool in_memory,
168 ProtocolHandlerMap* protocol_handlers) { 170 ProtocolHandlerMap* protocol_handlers,
171 ProtocolHandlerScopedVector protocol_interceptors) {
169 ShellBrowserContext* shell_browser_context = 172 ShellBrowserContext* shell_browser_context =
170 ShellBrowserContextForBrowserContext(content_browser_context); 173 ShellBrowserContextForBrowserContext(content_browser_context);
171 return shell_browser_context->CreateRequestContextForStoragePartition( 174 return shell_browser_context->CreateRequestContextForStoragePartition(
172 partition_path, in_memory, protocol_handlers); 175 partition_path,
176 in_memory,
177 protocol_handlers,
178 protocol_interceptors.Pass());
173 } 179 }
174 180
175 bool ShellContentBrowserClient::IsHandledURL(const GURL& url) { 181 bool ShellContentBrowserClient::IsHandledURL(const GURL& url) {
176 if (!url.is_valid()) 182 if (!url.is_valid())
177 return false; 183 return false;
178 DCHECK_EQ(url.scheme(), StringToLowerASCII(url.scheme())); 184 DCHECK_EQ(url.scheme(), StringToLowerASCII(url.scheme()));
179 // Keep in sync with ProtocolHandlers added by 185 // Keep in sync with ProtocolHandlers added by
180 // ShellURLRequestContextGetter::GetURLRequestContext(). 186 // ShellURLRequestContextGetter::GetURLRequestContext().
181 static const char* const kProtocolList[] = { 187 static const char* const kProtocolList[] = {
182 kBlobScheme, 188 kBlobScheme,
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 ShellBrowserContext* 339 ShellBrowserContext*
334 ShellContentBrowserClient::ShellBrowserContextForBrowserContext( 340 ShellContentBrowserClient::ShellBrowserContextForBrowserContext(
335 BrowserContext* content_browser_context) { 341 BrowserContext* content_browser_context) {
336 if (content_browser_context == browser_context()) 342 if (content_browser_context == browser_context())
337 return browser_context(); 343 return browser_context();
338 DCHECK_EQ(content_browser_context, off_the_record_browser_context()); 344 DCHECK_EQ(content_browser_context, off_the_record_browser_context());
339 return off_the_record_browser_context(); 345 return off_the_record_browser_context();
340 } 346 }
341 347
342 } // namespace content 348 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698