| 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 #ifndef CHROME_SERVICE_NET_SERVICE_URL_REQUEST_CONTEXT_H_ | 5 #ifndef CHROME_SERVICE_NET_SERVICE_URL_REQUEST_CONTEXT_H_ |
| 6 #define CHROME_SERVICE_NET_SERVICE_URL_REQUEST_CONTEXT_H_ | 6 #define CHROME_SERVICE_NET_SERVICE_URL_REQUEST_CONTEXT_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 // | 34 // |
| 35 class ServiceURLRequestContext : public net::URLRequestContext { | 35 class ServiceURLRequestContext : public net::URLRequestContext { |
| 36 public: | 36 public: |
| 37 // This context takes ownership of |net_proxy_config_service|. | 37 // This context takes ownership of |net_proxy_config_service|. |
| 38 explicit ServiceURLRequestContext( | 38 explicit ServiceURLRequestContext( |
| 39 const std::string& user_agent, | 39 const std::string& user_agent, |
| 40 net::ProxyConfigService* net_proxy_config_service); | 40 net::ProxyConfigService* net_proxy_config_service); |
| 41 | 41 |
| 42 virtual ~ServiceURLRequestContext(); | 42 virtual ~ServiceURLRequestContext(); |
| 43 | 43 |
| 44 // Overridden from net::URLRequestContext: | |
| 45 virtual const std::string& GetUserAgent(const GURL& url) const OVERRIDE; | |
| 46 | |
| 47 private: | 44 private: |
| 48 std::string user_agent_; | |
| 49 net::URLRequestContextStorage storage_; | 45 net::URLRequestContextStorage storage_; |
| 50 }; | 46 }; |
| 51 | 47 |
| 52 class ServiceURLRequestContextGetter : public net::URLRequestContextGetter { | 48 class ServiceURLRequestContextGetter : public net::URLRequestContextGetter { |
| 53 public: | 49 public: |
| 54 virtual net::URLRequestContext* GetURLRequestContext() OVERRIDE; | 50 virtual net::URLRequestContext* GetURLRequestContext() OVERRIDE; |
| 55 virtual scoped_refptr<base::SingleThreadTaskRunner> | 51 virtual scoped_refptr<base::SingleThreadTaskRunner> |
| 56 GetNetworkTaskRunner() const OVERRIDE; | 52 GetNetworkTaskRunner() const OVERRIDE; |
| 57 | 53 |
| 58 void set_user_agent(const std::string& ua) { | 54 void set_user_agent(const std::string& ua) { |
| 59 user_agent_ = ua; | 55 user_agent_ = ua; |
| 60 } | 56 } |
| 61 std::string user_agent() const { | 57 std::string user_agent() const { |
| 62 return user_agent_; | 58 return user_agent_; |
| 63 } | 59 } |
| 64 | 60 |
| 65 private: | 61 private: |
| 66 friend class ServiceProcess; | 62 friend class ServiceProcess; |
| 67 ServiceURLRequestContextGetter(); | 63 ServiceURLRequestContextGetter(); |
| 68 virtual ~ServiceURLRequestContextGetter(); | 64 virtual ~ServiceURLRequestContextGetter(); |
| 69 | 65 |
| 70 std::string user_agent_; | 66 std::string user_agent_; |
| 71 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_; | 67 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_; |
| 72 scoped_ptr<net::ProxyConfigService> proxy_config_service_; | 68 scoped_ptr<net::ProxyConfigService> proxy_config_service_; |
| 73 scoped_ptr<net::URLRequestContext> url_request_context_; | 69 scoped_ptr<net::URLRequestContext> url_request_context_; |
| 74 }; | 70 }; |
| 75 | 71 |
| 76 #endif // CHROME_SERVICE_NET_SERVICE_URL_REQUEST_CONTEXT_H_ | 72 #endif // CHROME_SERVICE_NET_SERVICE_URL_REQUEST_CONTEXT_H_ |
| OLD | NEW |