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

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

Issue 615583003: Introduce NetworkDelegate's implementation in extensions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
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_url_request_context_getter.h" 5 #include "content/shell/browser/shell_url_request_context_getter.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/string_split.h" 10 #include "base/strings/string_split.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) { 84 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) {
85 proxy_config_service_.reset( 85 proxy_config_service_.reset(
86 net::ProxyService::CreateSystemProxyConfigService( 86 net::ProxyService::CreateSystemProxyConfigService(
87 io_loop_->message_loop_proxy(), file_loop_->message_loop_proxy())); 87 io_loop_->message_loop_proxy(), file_loop_->message_loop_proxy()));
88 } 88 }
89 } 89 }
90 90
91 ShellURLRequestContextGetter::~ShellURLRequestContextGetter() { 91 ShellURLRequestContextGetter::~ShellURLRequestContextGetter() {
92 } 92 }
93 93
94 void ShellURLRequestContextGetter::set_network_delegate(
95 net::NetworkDelegate* network_delegate) {
96 network_delegate_.reset(network_delegate);
97 }
98
99 net::NetworkDelegate* ShellURLRequestContextGetter::CreateNetworkDelegate() {
100 return new ShellNetworkDelegate();
101 }
102
94 net::URLRequestContext* ShellURLRequestContextGetter::GetURLRequestContext() { 103 net::URLRequestContext* ShellURLRequestContextGetter::GetURLRequestContext() {
95 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 104 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
96 105
97 if (!url_request_context_) { 106 if (!url_request_context_) {
98 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 107 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
99 108
100 url_request_context_.reset(new net::URLRequestContext()); 109 url_request_context_.reset(new net::URLRequestContext());
101 url_request_context_->set_net_log(net_log_); 110 url_request_context_->set_net_log(net_log_);
102 network_delegate_.reset(new ShellNetworkDelegate); 111 if (!network_delegate_)
112 network_delegate_.reset(CreateNetworkDelegate());
103 if (command_line.HasSwitch(switches::kDumpRenderTree)) 113 if (command_line.HasSwitch(switches::kDumpRenderTree))
104 ShellNetworkDelegate::SetAcceptAllCookies(false); 114 ShellNetworkDelegate::SetAcceptAllCookies(false);
105 url_request_context_->set_network_delegate(network_delegate_.get()); 115 url_request_context_->set_network_delegate(network_delegate_.get());
106 storage_.reset( 116 storage_.reset(
107 new net::URLRequestContextStorage(url_request_context_.get())); 117 new net::URLRequestContextStorage(url_request_context_.get()));
108 storage_->set_cookie_store(CreateCookieStore(CookieStoreConfig())); 118 storage_->set_cookie_store(CreateCookieStore(CookieStoreConfig()));
109 storage_->set_channel_id_service(new net::ChannelIDService( 119 storage_->set_channel_id_service(new net::ChannelIDService(
110 new net::DefaultChannelIDStore(NULL), 120 new net::DefaultChannelIDStore(NULL),
111 base::WorkerPool::GetTaskRunner(true))); 121 base::WorkerPool::GetTaskRunner(true)));
112 storage_->set_http_user_agent_settings( 122 storage_->set_http_user_agent_settings(
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 scoped_refptr<base::SingleThreadTaskRunner> 249 scoped_refptr<base::SingleThreadTaskRunner>
240 ShellURLRequestContextGetter::GetNetworkTaskRunner() const { 250 ShellURLRequestContextGetter::GetNetworkTaskRunner() const {
241 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); 251 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO);
242 } 252 }
243 253
244 net::HostResolver* ShellURLRequestContextGetter::host_resolver() { 254 net::HostResolver* ShellURLRequestContextGetter::host_resolver() {
245 return url_request_context_->host_resolver(); 255 return url_request_context_->host_resolver();
246 } 256 }
247 257
248 } // namespace content 258 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698