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 "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 Loading... |
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 net::NetworkDelegate* ShellURLRequestContextGetter::CreateNetworkDelegate() { |
| 95 return new ShellNetworkDelegate; |
| 96 } |
| 97 |
94 net::URLRequestContext* ShellURLRequestContextGetter::GetURLRequestContext() { | 98 net::URLRequestContext* ShellURLRequestContextGetter::GetURLRequestContext() { |
95 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 99 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
96 | 100 |
97 if (!url_request_context_) { | 101 if (!url_request_context_) { |
98 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 102 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
99 | 103 |
100 url_request_context_.reset(new net::URLRequestContext()); | 104 url_request_context_.reset(new net::URLRequestContext()); |
101 url_request_context_->set_net_log(net_log_); | 105 url_request_context_->set_net_log(net_log_); |
102 network_delegate_.reset(new ShellNetworkDelegate); | 106 network_delegate_.reset(CreateNetworkDelegate()); |
103 if (command_line.HasSwitch(switches::kDumpRenderTree)) | 107 if (command_line.HasSwitch(switches::kDumpRenderTree)) |
104 ShellNetworkDelegate::SetAcceptAllCookies(false); | 108 ShellNetworkDelegate::SetAcceptAllCookies(false); |
105 url_request_context_->set_network_delegate(network_delegate_.get()); | 109 url_request_context_->set_network_delegate(network_delegate_.get()); |
106 storage_.reset( | 110 storage_.reset( |
107 new net::URLRequestContextStorage(url_request_context_.get())); | 111 new net::URLRequestContextStorage(url_request_context_.get())); |
108 storage_->set_cookie_store(CreateCookieStore(CookieStoreConfig())); | 112 storage_->set_cookie_store(CreateCookieStore(CookieStoreConfig())); |
109 storage_->set_channel_id_service(new net::ChannelIDService( | 113 storage_->set_channel_id_service(new net::ChannelIDService( |
110 new net::DefaultChannelIDStore(NULL), | 114 new net::DefaultChannelIDStore(NULL), |
111 base::WorkerPool::GetTaskRunner(true))); | 115 base::WorkerPool::GetTaskRunner(true))); |
112 storage_->set_http_user_agent_settings( | 116 storage_->set_http_user_agent_settings( |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 scoped_refptr<base::SingleThreadTaskRunner> | 243 scoped_refptr<base::SingleThreadTaskRunner> |
240 ShellURLRequestContextGetter::GetNetworkTaskRunner() const { | 244 ShellURLRequestContextGetter::GetNetworkTaskRunner() const { |
241 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); | 245 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); |
242 } | 246 } |
243 | 247 |
244 net::HostResolver* ShellURLRequestContextGetter::host_resolver() { | 248 net::HostResolver* ShellURLRequestContextGetter::host_resolver() { |
245 return url_request_context_->host_resolver(); | 249 return url_request_context_->host_resolver(); |
246 } | 250 } |
247 | 251 |
248 } // namespace content | 252 } // namespace content |
OLD | NEW |