Chromium Code Reviews| 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_auth_handler_negotiate.h" | |
| 13 #include "net/http/http_network_session.h" | 14 #include "net/http/http_network_session.h" |
| 14 #include "net/url_request/url_request_context_getter.h" | 15 #include "net/url_request/url_request_context_getter.h" |
| 15 #include "net/url_request/url_request_job_factory.h" | 16 #include "net/url_request/url_request_job_factory.h" |
| 16 | 17 |
| 18 class PrefService; | |
| 19 | |
| 17 namespace net { | 20 namespace net { |
| 18 class CookieStore; | 21 class CookieStore; |
| 22 class HostResolver; | |
| 19 class HttpTransactionFactory; | 23 class HttpTransactionFactory; |
| 20 class HttpUserAgentSettings; | 24 class HttpUserAgentSettings; |
| 21 class NetLog; | 25 class NetLog; |
| 22 class ProxyConfigService; | 26 class ProxyConfigService; |
| 23 class URLRequestContext; | 27 class URLRequestContext; |
| 24 class URLRequestJobFactory; | 28 class URLRequestJobFactory; |
| 29 class URLSecurityManager; | |
| 25 } | 30 } |
| 26 | 31 |
| 27 namespace android_webview { | 32 namespace android_webview { |
| 28 | 33 |
| 29 class AwNetworkDelegate; | 34 class AwNetworkDelegate; |
| 30 | 35 |
| 31 class AwURLRequestContextGetter : public net::URLRequestContextGetter { | 36 class AwURLRequestContextGetter : public net::URLRequestContextGetter { |
| 32 public: | 37 public: |
| 33 AwURLRequestContextGetter( | 38 AwURLRequestContextGetter(const base::FilePath& cache_path, |
| 34 const base::FilePath& cache_path, | 39 net::CookieStore* cookie_store, |
| 35 net::CookieStore* cookie_store, | 40 scoped_ptr<net::ProxyConfigService> config_service, |
| 36 scoped_ptr<net::ProxyConfigService> config_service); | 41 PrefService* pref_service); |
| 37 | 42 |
| 38 // net::URLRequestContextGetter implementation. | 43 // net::URLRequestContextGetter implementation. |
| 39 net::URLRequestContext* GetURLRequestContext() override; | 44 net::URLRequestContext* GetURLRequestContext() override; |
| 40 scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner() | 45 scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner() |
| 41 const override; | 46 const override; |
| 42 | 47 |
| 43 // NetLog is thread-safe, so clients can call this method from arbitrary | 48 // NetLog is thread-safe, so clients can call this method from arbitrary |
| 44 // threads (UI and IO). | 49 // threads (UI and IO). |
| 45 net::NetLog* GetNetLog(); | 50 net::NetLog* GetNetLog(); |
| 46 | 51 |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 57 // |job_factory_|. This ordering is enforced by having | 62 // |job_factory_|. This ordering is enforced by having |
| 58 // AwBrowserContext::CreateRequestContext() call this method. | 63 // AwBrowserContext::CreateRequestContext() call this method. |
| 59 // This method is necessary because the passed in objects are created | 64 // This method is necessary because the passed in objects are created |
| 60 // on the UI thread while |job_factory_| must be created on the IO thread. | 65 // on the UI thread while |job_factory_| must be created on the IO thread. |
| 61 void SetHandlersAndInterceptors( | 66 void SetHandlersAndInterceptors( |
| 62 content::ProtocolHandlerMap* protocol_handlers, | 67 content::ProtocolHandlerMap* protocol_handlers, |
| 63 content::URLRequestInterceptorScopedVector request_interceptors); | 68 content::URLRequestInterceptorScopedVector request_interceptors); |
| 64 | 69 |
| 65 void InitializeURLRequestContext(); | 70 void InitializeURLRequestContext(); |
| 66 | 71 |
| 72 // This is called to create a HttpAuthHandlerFactory that will handle | |
| 73 // negotiate challenges for the new URLRequestContext | |
| 74 scoped_ptr<net::HttpAuthHandlerNegotiate::Factory> | |
|
sgurun-gerrit only
2015/11/13 08:43:51
yeah, how will this work, it is only NET_EXPORT_PR
dgn
2015/11/13 12:37:07
Didn't notice that when I wrote the patch, and I g
sgurun-gerrit only
2015/11/18 02:23:28
the other cl already accumulated a lot of lgtm's s
dgn
2015/11/25 00:27:15
What I mentioned above doesn't seem to work anymor
dgn
2015/11/25 19:01:08
Fixed. I'm not creating a factory registry configu
| |
| 75 CreateNegotiateAuthHandlerFactory(net::HostResolver* resolver); | |
| 76 | |
| 67 const base::FilePath cache_path_; | 77 const base::FilePath cache_path_; |
| 68 | 78 |
| 69 scoped_ptr<net::NetLog> net_log_; | 79 scoped_ptr<net::NetLog> net_log_; |
| 70 scoped_ptr<net::ProxyConfigService> proxy_config_service_; | 80 scoped_ptr<net::ProxyConfigService> proxy_config_service_; |
| 71 scoped_ptr<net::HttpNetworkSession> http_network_session_; | 81 scoped_ptr<net::HttpNetworkSession> http_network_session_; |
| 72 scoped_ptr<net::HttpTransactionFactory> main_http_factory_; | 82 scoped_ptr<net::HttpTransactionFactory> main_http_factory_; |
| 73 scoped_refptr<net::CookieStore> cookie_store_; | 83 scoped_refptr<net::CookieStore> cookie_store_; |
| 74 scoped_ptr<net::URLRequestJobFactory> job_factory_; | 84 scoped_ptr<net::URLRequestJobFactory> job_factory_; |
| 75 scoped_ptr<net::HttpUserAgentSettings> http_user_agent_settings_; | 85 scoped_ptr<net::HttpUserAgentSettings> http_user_agent_settings_; |
| 76 scoped_ptr<net::URLRequestContext> url_request_context_; | 86 scoped_ptr<net::URLRequestContext> url_request_context_; |
| 77 | 87 |
| 88 // URLSecurityManager associated with the negotiate auth handler. It is | |
| 89 // configured to follow the auth_server_whitelist_ | |
| 90 scoped_ptr<net::URLSecurityManager> url_security_manager_; | |
| 91 | |
| 92 // Store HTTP Auth-related policies in this thread. | |
| 93 std::string auth_android_negotiate_account_type_; | |
| 94 std::string auth_server_whitelist_; | |
| 95 | |
| 78 // ProtocolHandlers and interceptors are stored here between | 96 // ProtocolHandlers and interceptors are stored here between |
| 79 // SetHandlersAndInterceptors() and the first GetURLRequestContext() call. | 97 // SetHandlersAndInterceptors() and the first GetURLRequestContext() call. |
| 80 content::ProtocolHandlerMap protocol_handlers_; | 98 content::ProtocolHandlerMap protocol_handlers_; |
| 81 content::URLRequestInterceptorScopedVector request_interceptors_; | 99 content::URLRequestInterceptorScopedVector request_interceptors_; |
| 82 | 100 |
| 83 DISALLOW_COPY_AND_ASSIGN(AwURLRequestContextGetter); | 101 DISALLOW_COPY_AND_ASSIGN(AwURLRequestContextGetter); |
| 84 }; | 102 }; |
| 85 | 103 |
| 86 } // namespace android_webview | 104 } // namespace android_webview |
| 87 | 105 |
| 88 #endif // ANDROID_WEBVIEW_BROWSER_NET_AW_URL_REQUEST_CONTEXT_GETTER_H_ | 106 #endif // ANDROID_WEBVIEW_BROWSER_NET_AW_URL_REQUEST_CONTEXT_GETTER_H_ |
| OLD | NEW |