OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/shell_url_request_context_getter.h" | 5 #include "content/shell/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/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 io_loop_->message_loop_proxy(), file_loop_)); | 77 io_loop_->message_loop_proxy(), file_loop_)); |
78 } | 78 } |
79 } | 79 } |
80 | 80 |
81 ShellURLRequestContextGetter::~ShellURLRequestContextGetter() { | 81 ShellURLRequestContextGetter::~ShellURLRequestContextGetter() { |
82 } | 82 } |
83 | 83 |
84 net::URLRequestContext* ShellURLRequestContextGetter::GetURLRequestContext() { | 84 net::URLRequestContext* ShellURLRequestContextGetter::GetURLRequestContext() { |
85 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 85 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
86 | 86 |
87 if (!url_request_context_.get()) { | 87 if (!url_request_context_) { |
88 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 88 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
89 | 89 |
90 url_request_context_.reset(new net::URLRequestContext()); | 90 url_request_context_.reset(new net::URLRequestContext()); |
91 network_delegate_.reset(new ShellNetworkDelegate); | 91 network_delegate_.reset(new ShellNetworkDelegate); |
92 if (command_line.HasSwitch(switches::kDumpRenderTree)) | 92 if (command_line.HasSwitch(switches::kDumpRenderTree)) |
93 ShellNetworkDelegate::SetAcceptAllCookies(false); | 93 ShellNetworkDelegate::SetAcceptAllCookies(false); |
94 url_request_context_->set_network_delegate(network_delegate_.get()); | 94 url_request_context_->set_network_delegate(network_delegate_.get()); |
95 storage_.reset( | 95 storage_.reset( |
96 new net::URLRequestContextStorage(url_request_context_.get())); | 96 new net::URLRequestContextStorage(url_request_context_.get())); |
97 storage_->set_cookie_store(new net::CookieMonster(NULL, NULL)); | 97 storage_->set_cookie_store(new net::CookieMonster(NULL, NULL)); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 scoped_refptr<base::SingleThreadTaskRunner> | 192 scoped_refptr<base::SingleThreadTaskRunner> |
193 ShellURLRequestContextGetter::GetNetworkTaskRunner() const { | 193 ShellURLRequestContextGetter::GetNetworkTaskRunner() const { |
194 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); | 194 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); |
195 } | 195 } |
196 | 196 |
197 net::HostResolver* ShellURLRequestContextGetter::host_resolver() { | 197 net::HostResolver* ShellURLRequestContextGetter::host_resolver() { |
198 return url_request_context_->host_resolver(); | 198 return url_request_context_->host_resolver(); |
199 } | 199 } |
200 | 200 |
201 } // namespace content | 201 } // namespace content |
OLD | NEW |