| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 // process where the profile is not available. | 34 // process where the profile is not available. |
| 35 // | 35 // |
| 36 class ServiceURLRequestContext : public net::URLRequestContext { | 36 class ServiceURLRequestContext : public net::URLRequestContext { |
| 37 public: | 37 public: |
| 38 // This context takes ownership of |net_proxy_config_service|. | 38 // This context takes ownership of |net_proxy_config_service|. |
| 39 explicit ServiceURLRequestContext( | 39 explicit ServiceURLRequestContext( |
| 40 const std::string& user_agent, | 40 const std::string& user_agent, |
| 41 net::ProxyConfigService* net_proxy_config_service); | 41 net::ProxyConfigService* net_proxy_config_service); |
| 42 | 42 |
| 43 // Overridden from net::URLRequestContext: | 43 // Overridden from net::URLRequestContext: |
| 44 virtual const std::string& GetUserAgent(const GURL& url) const; | 44 virtual const std::string& GetUserAgent(const GURL& url) const OVERRIDE; |
| 45 | 45 |
| 46 protected: | 46 protected: |
| 47 virtual ~ServiceURLRequestContext(); | 47 virtual ~ServiceURLRequestContext(); |
| 48 | 48 |
| 49 private: | 49 private: |
| 50 std::string user_agent_; | 50 std::string user_agent_; |
| 51 net::URLRequestContextStorage storage_; | 51 net::URLRequestContextStorage storage_; |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 class ServiceURLRequestContextGetter : public net::URLRequestContextGetter { | 54 class ServiceURLRequestContextGetter : public net::URLRequestContextGetter { |
| 55 public: | 55 public: |
| 56 virtual net::URLRequestContext* GetURLRequestContext(); | 56 virtual net::URLRequestContext* GetURLRequestContext() OVERRIDE; |
| 57 virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() const; | 57 virtual scoped_refptr<base::MessageLoopProxy> |
| 58 GetIOMessageLoopProxy() const OVERRIDE; |
| 58 | 59 |
| 59 void set_user_agent(const std::string& ua) { | 60 void set_user_agent(const std::string& ua) { |
| 60 user_agent_ = ua; | 61 user_agent_ = ua; |
| 61 } | 62 } |
| 62 std::string user_agent() const { | 63 std::string user_agent() const { |
| 63 return user_agent_; | 64 return user_agent_; |
| 64 } | 65 } |
| 65 | 66 |
| 66 private: | 67 private: |
| 67 friend class ServiceProcess; | 68 friend class ServiceProcess; |
| 68 ServiceURLRequestContextGetter(); | 69 ServiceURLRequestContextGetter(); |
| 69 virtual ~ServiceURLRequestContextGetter(); | 70 virtual ~ServiceURLRequestContextGetter(); |
| 70 | 71 |
| 71 std::string user_agent_; | 72 std::string user_agent_; |
| 72 scoped_refptr<net::URLRequestContext> url_request_context_; | 73 scoped_refptr<net::URLRequestContext> url_request_context_; |
| 73 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; | 74 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; |
| 74 scoped_ptr<net::ProxyConfigService> proxy_config_service_; | 75 scoped_ptr<net::ProxyConfigService> proxy_config_service_; |
| 75 }; | 76 }; |
| 76 | 77 |
| 77 #endif // CHROME_SERVICE_NET_SERVICE_URL_REQUEST_CONTEXT_H_ | 78 #endif // CHROME_SERVICE_NET_SERVICE_URL_REQUEST_CONTEXT_H_ |
| OLD | NEW |