| 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 ANDROID_WEBVIEW_BROWSER_NET_AW_URL_REQUEST_CONTEXT_GETTER_H_ | 5 #ifndef ANDROID_WEBVIEW_BROWSER_NET_AW_URL_REQUEST_CONTEXT_GETTER_H_ |
| 6 #define ANDROID_WEBVIEW_BROWSER_NET_AW_URL_REQUEST_CONTEXT_GETTER_H_ | 6 #define ANDROID_WEBVIEW_BROWSER_NET_AW_URL_REQUEST_CONTEXT_GETTER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "content/public/browser/content_browser_client.h" | 12 #include "content/public/browser/content_browser_client.h" |
| 13 #include "net/http/http_network_session.h" | 13 #include "net/http/http_network_session.h" |
| 14 #include "net/ssl/channel_id_service.h" | 14 #include "net/ssl/channel_id_service.h" |
| 15 #include "net/url_request/url_request_context_getter.h" | 15 #include "net/url_request/url_request_context_getter.h" |
| 16 #include "net/url_request/url_request_job_factory.h" | 16 #include "net/url_request/url_request_job_factory.h" |
| 17 | 17 |
| 18 namespace net { | 18 namespace net { |
| 19 class CookieStore; | 19 class CookieStore; |
| 20 class HttpTransactionFactory; | 20 class HttpTransactionFactory; |
| 21 class ProxyConfigService; | 21 class ProxyConfigService; |
| 22 class URLRequestContext; | 22 class URLRequestContext; |
| 23 class URLRequestJobFactory; | 23 class URLRequestJobFactory; |
| 24 } | 24 } |
| 25 | 25 |
| 26 namespace data_reduction_proxy { | 26 namespace data_reduction_proxy { |
| 27 class DataReductionProxyAuthRequestHandler; |
| 27 class DataReductionProxyConfigService; | 28 class DataReductionProxyConfigService; |
| 28 } | 29 } |
| 29 | 30 |
| 30 using data_reduction_proxy::DataReductionProxyConfigService; | |
| 31 | |
| 32 namespace android_webview { | 31 namespace android_webview { |
| 33 | 32 |
| 34 class AwNetworkDelegate; | 33 class AwNetworkDelegate; |
| 35 | 34 |
| 36 class AwURLRequestContextGetter : public net::URLRequestContextGetter { | 35 class AwURLRequestContextGetter : public net::URLRequestContextGetter { |
| 37 public: | 36 public: |
| 38 AwURLRequestContextGetter(const base::FilePath& partition_path, | 37 AwURLRequestContextGetter( |
| 39 net::CookieStore* cookie_store); | 38 const base::FilePath& partition_path, |
| 39 net::CookieStore* cookie_store, |
| 40 scoped_ptr<data_reduction_proxy::DataReductionProxyConfigService> |
| 41 config_service); |
| 40 | 42 |
| 41 void InitializeOnNetworkThread(); | 43 void InitializeOnNetworkThread(); |
| 42 | 44 |
| 43 // net::URLRequestContextGetter implementation. | 45 // net::URLRequestContextGetter implementation. |
| 44 virtual net::URLRequestContext* GetURLRequestContext() OVERRIDE; | 46 virtual net::URLRequestContext* GetURLRequestContext() OVERRIDE; |
| 45 virtual scoped_refptr<base::SingleThreadTaskRunner> | 47 virtual scoped_refptr<base::SingleThreadTaskRunner> |
| 46 GetNetworkTaskRunner() const OVERRIDE; | 48 GetNetworkTaskRunner() const OVERRIDE; |
| 47 | 49 |
| 48 DataReductionProxyConfigService* proxy_config_service(); | 50 data_reduction_proxy::DataReductionProxyAuthRequestHandler* |
| 51 GetDataReductionProxyAuthRequestHandler() const; |
| 49 | 52 |
| 50 private: | 53 private: |
| 51 friend class AwBrowserContext; | 54 friend class AwBrowserContext; |
| 52 virtual ~AwURLRequestContextGetter(); | 55 virtual ~AwURLRequestContextGetter(); |
| 53 | 56 |
| 54 // Prior to GetURLRequestContext() being called, this is called to hand over | 57 // Prior to GetURLRequestContext() being called, this is called to hand over |
| 55 // the objects that GetURLRequestContext() will later install into | 58 // the objects that GetURLRequestContext() will later install into |
| 56 // |job_factory_|. This ordering is enforced by having | 59 // |job_factory_|. This ordering is enforced by having |
| 57 // AwBrowserContext::CreateRequestContext() call this method. | 60 // AwBrowserContext::CreateRequestContext() call this method. |
| 58 // This method is necessary because the passed in objects are created | 61 // This method is necessary because the passed in objects are created |
| 59 // on the UI thread while |job_factory_| must be created on the IO thread. | 62 // on the UI thread while |job_factory_| must be created on the IO thread. |
| 60 void SetHandlersAndInterceptors( | 63 void SetHandlersAndInterceptors( |
| 61 content::ProtocolHandlerMap* protocol_handlers, | 64 content::ProtocolHandlerMap* protocol_handlers, |
| 62 content::URLRequestInterceptorScopedVector request_interceptors); | 65 content::URLRequestInterceptorScopedVector request_interceptors); |
| 63 | 66 |
| 64 void InitializeURLRequestContext(); | 67 void InitializeURLRequestContext(); |
| 65 | 68 |
| 66 const base::FilePath partition_path_; | 69 const base::FilePath partition_path_; |
| 67 scoped_refptr<net::CookieStore> cookie_store_; | 70 scoped_refptr<net::CookieStore> cookie_store_; |
| 68 scoped_ptr<net::URLRequestContext> url_request_context_; | 71 scoped_ptr<net::URLRequestContext> url_request_context_; |
| 69 scoped_ptr<DataReductionProxyConfigService> proxy_config_service_; | 72 scoped_ptr<data_reduction_proxy::DataReductionProxyConfigService> |
| 73 data_reduction_proxy_config_service_; |
| 74 scoped_ptr<data_reduction_proxy::DataReductionProxyAuthRequestHandler> |
| 75 data_reduction_proxy_auth_request_handler_; |
| 70 scoped_ptr<net::URLRequestJobFactory> job_factory_; | 76 scoped_ptr<net::URLRequestJobFactory> job_factory_; |
| 71 scoped_ptr<net::HttpTransactionFactory> main_http_factory_; | 77 scoped_ptr<net::HttpTransactionFactory> main_http_factory_; |
| 72 scoped_ptr<net::ChannelIDService> channel_id_service_; | 78 scoped_ptr<net::ChannelIDService> channel_id_service_; |
| 73 | 79 |
| 74 // ProtocolHandlers and interceptors are stored here between | 80 // ProtocolHandlers and interceptors are stored here between |
| 75 // SetHandlersAndInterceptors() and the first GetURLRequestContext() call. | 81 // SetHandlersAndInterceptors() and the first GetURLRequestContext() call. |
| 76 content::ProtocolHandlerMap protocol_handlers_; | 82 content::ProtocolHandlerMap protocol_handlers_; |
| 77 content::URLRequestInterceptorScopedVector request_interceptors_; | 83 content::URLRequestInterceptorScopedVector request_interceptors_; |
| 78 | 84 |
| 79 DISALLOW_COPY_AND_ASSIGN(AwURLRequestContextGetter); | 85 DISALLOW_COPY_AND_ASSIGN(AwURLRequestContextGetter); |
| 80 }; | 86 }; |
| 81 | 87 |
| 82 } // namespace android_webview | 88 } // namespace android_webview |
| 83 | 89 |
| 84 #endif // ANDROID_WEBVIEW_BROWSER_NET_AW_URL_REQUEST_CONTEXT_GETTER_H_ | 90 #endif // ANDROID_WEBVIEW_BROWSER_NET_AW_URL_REQUEST_CONTEXT_GETTER_H_ |
| OLD | NEW |