| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 |
| 11 #include "base/message_loop_proxy.h" | |
| 12 #include "chrome/common/net/url_request_context_getter.h" | 11 #include "chrome/common/net/url_request_context_getter.h" |
| 13 #include "net/base/cookie_monster.h" | 12 #include "net/base/cookie_monster.h" |
| 14 #include "net/base/cookie_policy.h" | 13 #include "net/base/cookie_policy.h" |
| 15 #include "net/base/host_resolver.h" | 14 #include "net/base/host_resolver.h" |
| 16 #include "net/base/ssl_config_service_defaults.h" | 15 #include "net/base/ssl_config_service_defaults.h" |
| 17 #include "net/disk_cache/disk_cache.h" | 16 #include "net/disk_cache/disk_cache.h" |
| 18 #include "net/ftp/ftp_network_layer.h" | 17 #include "net/ftp/ftp_network_layer.h" |
| 19 #include "net/http/http_auth_handler_factory.h" | 18 #include "net/http/http_auth_handler_factory.h" |
| 20 #include "net/http/http_cache.h" | 19 #include "net/http/http_cache.h" |
| 21 #include "net/http/http_network_layer.h" | 20 #include "net/http/http_network_layer.h" |
| 22 #include "net/proxy/proxy_service.h" | 21 #include "net/proxy/proxy_service.h" |
| 23 #include "net/url_request/url_request_context.h" | 22 #include "net/url_request/url_request_context.h" |
| 24 | 23 |
| 24 namespace base { |
| 25 class MessageLoopProxy; |
| 26 } |
| 27 |
| 25 // Subclass of URLRequestContext which can be used to store extra information | 28 // Subclass of URLRequestContext which can be used to store extra information |
| 26 // for requests. This subclass is meant to be used in the service process where | 29 // for requests. This subclass is meant to be used in the service process where |
| 27 // the profile is not available. | 30 // the profile is not available. |
| 28 // | 31 // |
| 29 class ServiceURLRequestContext : public URLRequestContext { | 32 class ServiceURLRequestContext : public URLRequestContext { |
| 30 public: | 33 public: |
| 31 ServiceURLRequestContext(); | 34 ServiceURLRequestContext(); |
| 32 void set_cookie_policy(net::CookiePolicy* policy) { | 35 void set_cookie_policy(net::CookiePolicy* policy) { |
| 33 cookie_policy_ = policy; | 36 cookie_policy_ = policy; |
| 34 } | 37 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 48 virtual ~ServiceURLRequestContext(); | 51 virtual ~ServiceURLRequestContext(); |
| 49 | 52 |
| 50 private: | 53 private: |
| 51 std::string user_agent_; | 54 std::string user_agent_; |
| 52 }; | 55 }; |
| 53 | 56 |
| 54 class ServiceURLRequestContextGetter : public URLRequestContextGetter { | 57 class ServiceURLRequestContextGetter : public URLRequestContextGetter { |
| 55 public: | 58 public: |
| 56 ServiceURLRequestContextGetter(); | 59 ServiceURLRequestContextGetter(); |
| 57 | 60 |
| 58 virtual URLRequestContext* GetURLRequestContext() { | 61 virtual URLRequestContext* GetURLRequestContext(); |
| 59 if (!url_request_context_) | 62 virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy(); |
| 60 url_request_context_ = new ServiceURLRequestContext(); | |
| 61 return url_request_context_; | |
| 62 } | |
| 63 virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() { | |
| 64 return io_message_loop_proxy_; | |
| 65 } | |
| 66 | 63 |
| 67 void set_user_agent(const std::string& ua) { | 64 void set_user_agent(const std::string& ua) { |
| 68 user_agent_ = ua; | 65 user_agent_ = ua; |
| 69 } | 66 } |
| 70 private: | 67 private: |
| 71 ~ServiceURLRequestContextGetter() {} | 68 virtual ~ServiceURLRequestContextGetter(); |
| 72 | 69 |
| 73 std::string user_agent_; | 70 std::string user_agent_; |
| 74 scoped_refptr<URLRequestContext> url_request_context_; | 71 scoped_refptr<URLRequestContext> url_request_context_; |
| 75 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; | 72 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; |
| 76 }; | 73 }; |
| 77 | 74 |
| 78 #endif // CHROME_SERVICE_NET_SERVICE_URL_REQUEST_CONTEXT_H_ | 75 #endif // CHROME_SERVICE_NET_SERVICE_URL_REQUEST_CONTEXT_H_ |
| 79 | 76 |
| OLD | NEW |