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 <memory> |
| 9 |
8 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
9 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
10 #include "base/macros.h" | 12 #include "base/macros.h" |
11 #include "base/memory/scoped_ptr.h" | |
12 #include "components/prefs/pref_member.h" | 13 #include "components/prefs/pref_member.h" |
13 #include "content/public/browser/content_browser_client.h" | 14 #include "content/public/browser/content_browser_client.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 |
17 class PrefService; | 18 class PrefService; |
18 | 19 |
19 namespace net { | 20 namespace net { |
20 class HostResolver; | 21 class HostResolver; |
21 class HttpAuthHandlerFactory; | 22 class HttpAuthHandlerFactory; |
22 class HttpAuthPreferences; | 23 class HttpAuthPreferences; |
23 class HttpUserAgentSettings; | 24 class HttpUserAgentSettings; |
24 class NetLog; | 25 class NetLog; |
25 class ProxyConfigService; | 26 class ProxyConfigService; |
26 class URLRequestContext; | 27 class URLRequestContext; |
27 class URLRequestJobFactory; | 28 class URLRequestJobFactory; |
28 } | 29 } |
29 | 30 |
30 namespace android_webview { | 31 namespace android_webview { |
31 | 32 |
32 class AwNetworkDelegate; | 33 class AwNetworkDelegate; |
33 | 34 |
34 class AwURLRequestContextGetter : public net::URLRequestContextGetter { | 35 class AwURLRequestContextGetter : public net::URLRequestContextGetter { |
35 public: | 36 public: |
36 AwURLRequestContextGetter( | 37 AwURLRequestContextGetter( |
37 const base::FilePath& cache_path, | 38 const base::FilePath& cache_path, |
38 scoped_ptr<net::ProxyConfigService> config_service, | 39 std::unique_ptr<net::ProxyConfigService> config_service, |
39 PrefService* pref_service); | 40 PrefService* pref_service); |
40 | 41 |
41 // net::URLRequestContextGetter implementation. | 42 // net::URLRequestContextGetter implementation. |
42 net::URLRequestContext* GetURLRequestContext() override; | 43 net::URLRequestContext* GetURLRequestContext() override; |
43 scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner() | 44 scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner() |
44 const override; | 45 const override; |
45 | 46 |
46 // 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 |
47 // threads (UI and IO). | 48 // threads (UI and IO). |
48 net::NetLog* GetNetLog(); | 49 net::NetLog* GetNetLog(); |
(...skipping 13 matching lines...) Expand all Loading... |
62 // This method is necessary because the passed in objects are created | 63 // This method is necessary because the passed in objects are created |
63 // 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. |
64 void SetHandlersAndInterceptors( | 65 void SetHandlersAndInterceptors( |
65 content::ProtocolHandlerMap* protocol_handlers, | 66 content::ProtocolHandlerMap* protocol_handlers, |
66 content::URLRequestInterceptorScopedVector request_interceptors); | 67 content::URLRequestInterceptorScopedVector request_interceptors); |
67 | 68 |
68 void InitializeURLRequestContext(); | 69 void InitializeURLRequestContext(); |
69 | 70 |
70 // This is called to create a HttpAuthHandlerFactory that will handle | 71 // This is called to create a HttpAuthHandlerFactory that will handle |
71 // auth challenges for the new URLRequestContext | 72 // auth challenges for the new URLRequestContext |
72 scoped_ptr<net::HttpAuthHandlerFactory> CreateAuthHandlerFactory( | 73 std::unique_ptr<net::HttpAuthHandlerFactory> CreateAuthHandlerFactory( |
73 net::HostResolver* resolver); | 74 net::HostResolver* resolver); |
74 | 75 |
75 // Update methods for the auth related preferences | 76 // Update methods for the auth related preferences |
76 void UpdateServerWhitelist(); | 77 void UpdateServerWhitelist(); |
77 void UpdateAndroidAuthNegotiateAccountType(); | 78 void UpdateAndroidAuthNegotiateAccountType(); |
78 | 79 |
79 const base::FilePath cache_path_; | 80 const base::FilePath cache_path_; |
80 | 81 |
81 scoped_ptr<net::NetLog> net_log_; | 82 std::unique_ptr<net::NetLog> net_log_; |
82 scoped_ptr<net::ProxyConfigService> proxy_config_service_; | 83 std::unique_ptr<net::ProxyConfigService> proxy_config_service_; |
83 scoped_ptr<net::URLRequestJobFactory> job_factory_; | 84 std::unique_ptr<net::URLRequestJobFactory> job_factory_; |
84 scoped_ptr<net::HttpUserAgentSettings> http_user_agent_settings_; | 85 std::unique_ptr<net::HttpUserAgentSettings> http_user_agent_settings_; |
85 // http_auth_preferences_ holds the preferences for the negotiate | 86 // http_auth_preferences_ holds the preferences for the negotiate |
86 // authenticator. | 87 // authenticator. |
87 scoped_ptr<net::HttpAuthPreferences> http_auth_preferences_; | 88 std::unique_ptr<net::HttpAuthPreferences> http_auth_preferences_; |
88 scoped_ptr<net::URLRequestContext> url_request_context_; | 89 std::unique_ptr<net::URLRequestContext> url_request_context_; |
89 | 90 |
90 // Store HTTP Auth-related policies in this thread. | 91 // Store HTTP Auth-related policies in this thread. |
91 StringPrefMember auth_android_negotiate_account_type_; | 92 StringPrefMember auth_android_negotiate_account_type_; |
92 StringPrefMember auth_server_whitelist_; | 93 StringPrefMember auth_server_whitelist_; |
93 | 94 |
94 // ProtocolHandlers and interceptors are stored here between | 95 // ProtocolHandlers and interceptors are stored here between |
95 // SetHandlersAndInterceptors() and the first GetURLRequestContext() call. | 96 // SetHandlersAndInterceptors() and the first GetURLRequestContext() call. |
96 content::ProtocolHandlerMap protocol_handlers_; | 97 content::ProtocolHandlerMap protocol_handlers_; |
97 content::URLRequestInterceptorScopedVector request_interceptors_; | 98 content::URLRequestInterceptorScopedVector request_interceptors_; |
98 | 99 |
99 DISALLOW_COPY_AND_ASSIGN(AwURLRequestContextGetter); | 100 DISALLOW_COPY_AND_ASSIGN(AwURLRequestContextGetter); |
100 }; | 101 }; |
101 | 102 |
102 } // namespace android_webview | 103 } // namespace android_webview |
103 | 104 |
104 #endif // ANDROID_WEBVIEW_BROWSER_NET_AW_URL_REQUEST_CONTEXT_GETTER_H_ | 105 #endif // ANDROID_WEBVIEW_BROWSER_NET_AW_URL_REQUEST_CONTEXT_GETTER_H_ |
OLD | NEW |