| 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 27 matching lines...) Expand all Loading... |
| 38 ShellURLRequestContextGetter::ShellURLRequestContextGetter( | 38 ShellURLRequestContextGetter::ShellURLRequestContextGetter( |
| 39 bool ignore_certificate_errors, | 39 bool ignore_certificate_errors, |
| 40 const base::FilePath& base_path, | 40 const base::FilePath& base_path, |
| 41 MessageLoop* io_loop, | 41 MessageLoop* io_loop, |
| 42 MessageLoop* file_loop, | 42 MessageLoop* file_loop, |
| 43 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 43 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 44 blob_protocol_handler, | 44 blob_protocol_handler, |
| 45 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 45 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 46 file_system_protocol_handler, | 46 file_system_protocol_handler, |
| 47 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 47 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 48 developer_protocol_handler, | |
| 49 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
| 50 chrome_protocol_handler, | 48 chrome_protocol_handler, |
| 51 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 49 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 52 chrome_devtools_protocol_handler) | 50 chrome_devtools_protocol_handler) |
| 53 : ignore_certificate_errors_(ignore_certificate_errors), | 51 : ignore_certificate_errors_(ignore_certificate_errors), |
| 54 base_path_(base_path), | 52 base_path_(base_path), |
| 55 io_loop_(io_loop), | 53 io_loop_(io_loop), |
| 56 file_loop_(file_loop), | 54 file_loop_(file_loop), |
| 57 blob_protocol_handler_(blob_protocol_handler.Pass()), | 55 blob_protocol_handler_(blob_protocol_handler.Pass()), |
| 58 file_system_protocol_handler_(file_system_protocol_handler.Pass()), | 56 file_system_protocol_handler_(file_system_protocol_handler.Pass()), |
| 59 developer_protocol_handler_(developer_protocol_handler.Pass()), | |
| 60 chrome_protocol_handler_(chrome_protocol_handler.Pass()), | 57 chrome_protocol_handler_(chrome_protocol_handler.Pass()), |
| 61 chrome_devtools_protocol_handler_( | 58 chrome_devtools_protocol_handler_( |
| 62 chrome_devtools_protocol_handler.Pass()) { | 59 chrome_devtools_protocol_handler.Pass()) { |
| 63 // Must first be created on the UI thread. | 60 // Must first be created on the UI thread. |
| 64 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 61 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 65 | 62 |
| 66 // We must create the proxy config service on the UI loop on Linux because it | 63 // We must create the proxy config service on the UI loop on Linux because it |
| 67 // must synchronously run on the glib message loop. This will be passed to | 64 // must synchronously run on the glib message loop. This will be passed to |
| 68 // the URLRequestContextStorage on the IO thread in GetURLRequestContext(). | 65 // the URLRequestContextStorage on the IO thread in GetURLRequestContext(). |
| 69 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) { | 66 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) { |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 set_protocol = job_factory->SetProtocolHandler( | 176 set_protocol = job_factory->SetProtocolHandler( |
| 180 chrome::kFileSystemScheme, file_system_protocol_handler_.release()); | 177 chrome::kFileSystemScheme, file_system_protocol_handler_.release()); |
| 181 DCHECK(set_protocol); | 178 DCHECK(set_protocol); |
| 182 set_protocol = job_factory->SetProtocolHandler( | 179 set_protocol = job_factory->SetProtocolHandler( |
| 183 chrome::kChromeUIScheme, chrome_protocol_handler_.release()); | 180 chrome::kChromeUIScheme, chrome_protocol_handler_.release()); |
| 184 DCHECK(set_protocol); | 181 DCHECK(set_protocol); |
| 185 set_protocol = job_factory->SetProtocolHandler( | 182 set_protocol = job_factory->SetProtocolHandler( |
| 186 chrome::kChromeDevToolsScheme, | 183 chrome::kChromeDevToolsScheme, |
| 187 chrome_devtools_protocol_handler_.release()); | 184 chrome_devtools_protocol_handler_.release()); |
| 188 DCHECK(set_protocol); | 185 DCHECK(set_protocol); |
| 189 storage_->set_job_factory(new net::ProtocolInterceptJobFactory( | 186 storage_->set_job_factory(job_factory.release()); |
| 190 job_factory.PassAs<net::URLRequestJobFactory>(), | |
| 191 developer_protocol_handler_.Pass())); | |
| 192 } | 187 } |
| 193 | 188 |
| 194 return url_request_context_.get(); | 189 return url_request_context_.get(); |
| 195 } | 190 } |
| 196 | 191 |
| 197 scoped_refptr<base::SingleThreadTaskRunner> | 192 scoped_refptr<base::SingleThreadTaskRunner> |
| 198 ShellURLRequestContextGetter::GetNetworkTaskRunner() const { | 193 ShellURLRequestContextGetter::GetNetworkTaskRunner() const { |
| 199 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); | 194 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); |
| 200 } | 195 } |
| 201 | 196 |
| 202 net::HostResolver* ShellURLRequestContextGetter::host_resolver() { | 197 net::HostResolver* ShellURLRequestContextGetter::host_resolver() { |
| 203 return url_request_context_->host_resolver(); | 198 return url_request_context_->host_resolver(); |
| 204 } | 199 } |
| 205 | 200 |
| 206 } // namespace content | 201 } // namespace content |
| OLD | NEW |