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 |
11 #include "chrome/common/net/url_request_context_getter.h" | 11 #include "chrome/common/net/url_request_context_getter.h" |
12 #include "net/base/cookie_monster.h" | 12 #include "net/base/cookie_monster.h" |
13 #include "net/base/cookie_policy.h" | 13 #include "net/base/cookie_policy.h" |
14 #include "net/base/host_resolver.h" | 14 #include "net/base/host_resolver.h" |
15 #include "net/base/ssl_config_service_defaults.h" | 15 #include "net/base/ssl_config_service_defaults.h" |
16 #include "net/disk_cache/disk_cache.h" | 16 #include "net/disk_cache/disk_cache.h" |
17 #include "net/ftp/ftp_network_layer.h" | 17 #include "net/ftp/ftp_network_layer.h" |
18 #include "net/http/http_auth_handler_factory.h" | 18 #include "net/http/http_auth_handler_factory.h" |
19 #include "net/http/http_cache.h" | 19 #include "net/http/http_cache.h" |
20 #include "net/http/http_network_layer.h" | 20 #include "net/http/http_network_layer.h" |
21 #include "net/proxy/proxy_service.h" | 21 #include "net/proxy/proxy_service.h" |
22 #include "net/url_request/url_request_context.h" | 22 #include "net/url_request/url_request_context.h" |
23 | 23 |
24 namespace base { | 24 namespace base { |
25 class MessageLoopProxy; | 25 class MessageLoopProxy; |
26 } | 26 } |
27 | 27 |
28 // Subclass of URLRequestContext which can be used to store extra information | 28 // Subclass of net::URLRequestContext which can be used to store extra |
29 // for requests. This subclass is meant to be used in the service process where | 29 // information for requests. This subclass is meant to be used in the service |
30 // the profile is not available. | 30 // process where the profile is not available. |
31 // | 31 // |
32 class ServiceURLRequestContext : public net::URLRequestContext { | 32 class ServiceURLRequestContext : public net::URLRequestContext { |
33 public: | 33 public: |
34 explicit ServiceURLRequestContext(const std::string& user_agent); | 34 explicit ServiceURLRequestContext(const std::string& user_agent); |
35 void set_cookie_policy(net::CookiePolicy* policy) { | 35 void set_cookie_policy(net::CookiePolicy* policy) { |
36 cookie_policy_ = policy; | 36 cookie_policy_ = policy; |
37 } | 37 } |
38 | 38 |
39 // URLRequestContext overrides | 39 // Overridden from net::URLRequestContext: |
40 virtual const std::string& GetUserAgent(const GURL& url) const; | 40 virtual const std::string& GetUserAgent(const GURL& url) const; |
41 | 41 |
42 protected: | 42 protected: |
43 virtual ~ServiceURLRequestContext(); | 43 virtual ~ServiceURLRequestContext(); |
44 | 44 |
45 private: | 45 private: |
46 std::string user_agent_; | 46 std::string user_agent_; |
47 }; | 47 }; |
48 | 48 |
49 class ServiceURLRequestContextGetter : public URLRequestContextGetter { | 49 class ServiceURLRequestContextGetter : public URLRequestContextGetter { |
(...skipping 12 matching lines...) Expand all Loading... |
62 private: | 62 private: |
63 virtual ~ServiceURLRequestContextGetter(); | 63 virtual ~ServiceURLRequestContextGetter(); |
64 | 64 |
65 std::string user_agent_; | 65 std::string user_agent_; |
66 scoped_refptr<net::URLRequestContext> url_request_context_; | 66 scoped_refptr<net::URLRequestContext> url_request_context_; |
67 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; | 67 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; |
68 }; | 68 }; |
69 | 69 |
70 #endif // CHROME_SERVICE_NET_SERVICE_URL_REQUEST_CONTEXT_H_ | 70 #endif // CHROME_SERVICE_NET_SERVICE_URL_REQUEST_CONTEXT_H_ |
71 | 71 |
OLD | NEW |