| 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 "chrome/browser/io_thread.h" | 5 #include "chrome/browser/io_thread.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 | 73 |
| 74 // Custom URLRequestContext used by requests which aren't associated with a | 74 // Custom URLRequestContext used by requests which aren't associated with a |
| 75 // particular profile. We need to use a subclass of URLRequestContext in order | 75 // particular profile. We need to use a subclass of URLRequestContext in order |
| 76 // to provide the correct User-Agent. | 76 // to provide the correct User-Agent. |
| 77 class URLRequestContextWithUserAgent : public net::URLRequestContext { | 77 class URLRequestContextWithUserAgent : public net::URLRequestContext { |
| 78 public: | 78 public: |
| 79 virtual const std::string& GetUserAgent( | 79 virtual const std::string& GetUserAgent( |
| 80 const GURL& url) const OVERRIDE { | 80 const GURL& url) const OVERRIDE { |
| 81 return content::GetUserAgent(url); | 81 return content::GetUserAgent(url); |
| 82 } | 82 } |
| 83 |
| 84 protected: |
| 85 virtual ~URLRequestContextWithUserAgent() {} |
| 83 }; | 86 }; |
| 84 | 87 |
| 85 // Used for the "system" URLRequestContext. If this grows more complicated, then | 88 // Used for the "system" URLRequestContext. If this grows more complicated, then |
| 86 // consider inheriting directly from URLRequestContext rather than using | 89 // consider inheriting directly from URLRequestContext rather than using |
| 87 // implementation inheritance. | 90 // implementation inheritance. |
| 88 class SystemURLRequestContext : public URLRequestContextWithUserAgent { | 91 class SystemURLRequestContext : public URLRequestContextWithUserAgent { |
| 89 public: | 92 public: |
| 90 SystemURLRequestContext() { | 93 SystemURLRequestContext() { |
| 91 #if defined(USE_NSS) | 94 #if defined(USE_NSS) |
| 92 net::SetURLRequestContextForNSSHttpIO(this); | 95 net::SetURLRequestContextForNSSHttpIO(this); |
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 613 new net::HttpNetworkLayer( | 616 new net::HttpNetworkLayer( |
| 614 new net::HttpNetworkSession(system_params))); | 617 new net::HttpNetworkSession(system_params))); |
| 615 globals_->system_ftp_transaction_factory.reset( | 618 globals_->system_ftp_transaction_factory.reset( |
| 616 new net::FtpNetworkLayer(globals_->host_resolver.get())); | 619 new net::FtpNetworkLayer(globals_->host_resolver.get())); |
| 617 globals_->system_request_context = | 620 globals_->system_request_context = |
| 618 ConstructSystemRequestContext(globals_, net_log_); | 621 ConstructSystemRequestContext(globals_, net_log_); |
| 619 | 622 |
| 620 sdch_manager_->set_sdch_fetcher( | 623 sdch_manager_->set_sdch_fetcher( |
| 621 new SdchDictionaryFetcher(system_url_request_context_getter_.get())); | 624 new SdchDictionaryFetcher(system_url_request_context_getter_.get())); |
| 622 } | 625 } |
| OLD | NEW |