| 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/url_request/url_request_context_getter.h" | 13 #include "net/url_request/url_request_context_getter.h" |
| 14 #include "net/url_request/url_request_job_factory.h" | 14 #include "net/url_request/url_request_job_factory.h" |
| 15 | 15 |
| 16 class PrefService; |
| 17 |
| 16 namespace net { | 18 namespace net { |
| 17 class CookieStore; | 19 class CookieStore; |
| 20 class HostResolver; |
| 21 class HttpAuthHandlerFactory; |
| 18 class HttpUserAgentSettings; | 22 class HttpUserAgentSettings; |
| 19 class NetLog; | 23 class NetLog; |
| 20 class ProxyConfigService; | 24 class ProxyConfigService; |
| 21 class URLRequestContext; | 25 class URLRequestContext; |
| 22 class URLRequestJobFactory; | 26 class URLRequestJobFactory; |
| 27 class URLSecurityManager; |
| 23 } | 28 } |
| 24 | 29 |
| 25 namespace android_webview { | 30 namespace android_webview { |
| 26 | 31 |
| 27 class AwNetworkDelegate; | 32 class AwNetworkDelegate; |
| 28 | 33 |
| 29 class AwURLRequestContextGetter : public net::URLRequestContextGetter { | 34 class AwURLRequestContextGetter : public net::URLRequestContextGetter { |
| 30 public: | 35 public: |
| 31 AwURLRequestContextGetter( | 36 AwURLRequestContextGetter( |
| 32 const base::FilePath& cache_path, | 37 const base::FilePath& cache_path, |
| 33 net::CookieStore* cookie_store, | 38 net::CookieStore* cookie_store, |
| 34 scoped_ptr<net::ProxyConfigService> config_service); | 39 scoped_ptr<net::ProxyConfigService> config_service, |
| 40 PrefService* pref_service); |
| 35 | 41 |
| 36 // net::URLRequestContextGetter implementation. | 42 // net::URLRequestContextGetter implementation. |
| 37 net::URLRequestContext* GetURLRequestContext() override; | 43 net::URLRequestContext* GetURLRequestContext() override; |
| 38 scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner() | 44 scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner() |
| 39 const override; | 45 const override; |
| 40 | 46 |
| 41 // NetLog is thread-safe, so clients can call this method from arbitrary | 47 // NetLog is thread-safe, so clients can call this method from arbitrary |
| 42 // threads (UI and IO). | 48 // threads (UI and IO). |
| 43 net::NetLog* GetNetLog(); | 49 net::NetLog* GetNetLog(); |
| 44 | 50 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 55 // |job_factory_|. This ordering is enforced by having | 61 // |job_factory_|. This ordering is enforced by having |
| 56 // AwBrowserContext::CreateRequestContext() call this method. | 62 // AwBrowserContext::CreateRequestContext() call this method. |
| 57 // This method is necessary because the passed in objects are created | 63 // This method is necessary because the passed in objects are created |
| 58 // on the UI thread while |job_factory_| must be created on the IO thread. | 64 // on the UI thread while |job_factory_| must be created on the IO thread. |
| 59 void SetHandlersAndInterceptors( | 65 void SetHandlersAndInterceptors( |
| 60 content::ProtocolHandlerMap* protocol_handlers, | 66 content::ProtocolHandlerMap* protocol_handlers, |
| 61 content::URLRequestInterceptorScopedVector request_interceptors); | 67 content::URLRequestInterceptorScopedVector request_interceptors); |
| 62 | 68 |
| 63 void InitializeURLRequestContext(); | 69 void InitializeURLRequestContext(); |
| 64 | 70 |
| 71 // This is called to create a HttpAuthHandlerFactory that will handle |
| 72 // negotiate challenges for the new URLRequestContext |
| 73 scoped_ptr<net::HttpAuthHandlerFactory> |
| 74 CreateNegotiateAuthHandlerFactory(net::HostResolver* resolver); |
| 75 |
| 65 const base::FilePath cache_path_; | 76 const base::FilePath cache_path_; |
| 66 | 77 |
| 67 scoped_ptr<net::NetLog> net_log_; | 78 scoped_ptr<net::NetLog> net_log_; |
| 68 scoped_ptr<net::ProxyConfigService> proxy_config_service_; | 79 scoped_ptr<net::ProxyConfigService> proxy_config_service_; |
| 69 scoped_refptr<net::CookieStore> cookie_store_; | 80 scoped_refptr<net::CookieStore> cookie_store_; |
| 70 scoped_ptr<net::URLRequestJobFactory> job_factory_; | 81 scoped_ptr<net::URLRequestJobFactory> job_factory_; |
| 71 scoped_ptr<net::HttpUserAgentSettings> http_user_agent_settings_; | 82 scoped_ptr<net::HttpUserAgentSettings> http_user_agent_settings_; |
| 72 scoped_ptr<net::URLRequestContext> url_request_context_; | 83 scoped_ptr<net::URLRequestContext> url_request_context_; |
| 73 | 84 |
| 85 // URLSecurityManager associated with the negotiate auth handler. It is |
| 86 // configured to follow the auth_server_whitelist_ |
| 87 scoped_ptr<net::URLSecurityManager> url_security_manager_; |
| 88 |
| 89 // Store HTTP Auth-related policies in this thread. |
| 90 std::string auth_android_negotiate_account_type_; |
| 91 std::string auth_server_whitelist_; |
| 92 |
| 74 // ProtocolHandlers and interceptors are stored here between | 93 // ProtocolHandlers and interceptors are stored here between |
| 75 // SetHandlersAndInterceptors() and the first GetURLRequestContext() call. | 94 // SetHandlersAndInterceptors() and the first GetURLRequestContext() call. |
| 76 content::ProtocolHandlerMap protocol_handlers_; | 95 content::ProtocolHandlerMap protocol_handlers_; |
| 77 content::URLRequestInterceptorScopedVector request_interceptors_; | 96 content::URLRequestInterceptorScopedVector request_interceptors_; |
| 78 | 97 |
| 79 DISALLOW_COPY_AND_ASSIGN(AwURLRequestContextGetter); | 98 DISALLOW_COPY_AND_ASSIGN(AwURLRequestContextGetter); |
| 80 }; | 99 }; |
| 81 | 100 |
| 82 } // namespace android_webview | 101 } // namespace android_webview |
| 83 | 102 |
| 84 #endif // ANDROID_WEBVIEW_BROWSER_NET_AW_URL_REQUEST_CONTEXT_GETTER_H_ | 103 #endif // ANDROID_WEBVIEW_BROWSER_NET_AW_URL_REQUEST_CONTEXT_GETTER_H_ |
| OLD | NEW |