| 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" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 class URLRequestContext; | 21 class URLRequestContext; |
| 22 class URLRequestJobFactory; | 22 class URLRequestJobFactory; |
| 23 } | 23 } |
| 24 | 24 |
| 25 namespace android_webview { | 25 namespace android_webview { |
| 26 | 26 |
| 27 class AwNetworkDelegate; | 27 class AwNetworkDelegate; |
| 28 | 28 |
| 29 class AwURLRequestContextGetter : public net::URLRequestContextGetter { | 29 class AwURLRequestContextGetter : public net::URLRequestContextGetter { |
| 30 public: | 30 public: |
| 31 AwURLRequestContextGetter(const base::FilePath& partition_path, | 31 AwURLRequestContextGetter(const base::FilePath& partition_path); |
| 32 net::CookieStore* cookie_store); | |
| 33 | 32 |
| 34 void InitializeOnNetworkThread(); | 33 void InitializeOnNetworkThread(); |
| 35 | 34 |
| 36 // net::URLRequestContextGetter implementation. | 35 // net::URLRequestContextGetter implementation. |
| 37 virtual net::URLRequestContext* GetURLRequestContext() OVERRIDE; | 36 virtual net::URLRequestContext* GetURLRequestContext() OVERRIDE; |
| 38 virtual scoped_refptr<base::SingleThreadTaskRunner> | 37 virtual scoped_refptr<base::SingleThreadTaskRunner> |
| 39 GetNetworkTaskRunner() const OVERRIDE; | 38 GetNetworkTaskRunner() const OVERRIDE; |
| 40 | 39 |
| 41 private: | 40 private: |
| 42 friend class AwBrowserContext; | 41 friend class AwBrowserContext; |
| 43 virtual ~AwURLRequestContextGetter(); | 42 virtual ~AwURLRequestContextGetter(); |
| 44 | 43 |
| 45 // Prior to GetURLRequestContext() being called, SetProtocolHandlers() is | 44 // Prior to GetURLRequestContext() being called, SetProtocolHandlers() is |
| 46 // called to hand over the ProtocolHandlers that GetURLRequestContext() will | 45 // called to hand over the ProtocolHandlers that GetURLRequestContext() will |
| 47 // later install into |job_factory_|. This ordering is enforced by having | 46 // later install into |job_factory_|. This ordering is enforced by having |
| 48 // AwBrowserContext::CreateRequestContext() call SetProtocolHandlers(). | 47 // AwBrowserContext::CreateRequestContext() call SetProtocolHandlers(). |
| 49 // SetProtocolHandlers() is necessary because the ProtocolHandlers are created | 48 // SetProtocolHandlers() is necessary because the ProtocolHandlers are created |
| 50 // on the UI thread while |job_factory_| must be created on the IO thread. | 49 // on the UI thread while |job_factory_| must be created on the IO thread. |
| 51 void SetProtocolHandlers(content::ProtocolHandlerMap* protocol_handlers); | 50 void SetProtocolHandlers(content::ProtocolHandlerMap* protocol_handlers); |
| 52 | 51 |
| 53 void InitializeURLRequestContext(); | 52 void InitializeURLRequestContext(); |
| 54 | 53 |
| 55 const base::FilePath partition_path_; | 54 const base::FilePath partition_path_; |
| 56 scoped_refptr<net::CookieStore> cookie_store_; | |
| 57 scoped_ptr<net::URLRequestContext> url_request_context_; | 55 scoped_ptr<net::URLRequestContext> url_request_context_; |
| 58 scoped_ptr<net::ProxyConfigService> proxy_config_service_; | 56 scoped_ptr<net::ProxyConfigService> proxy_config_service_; |
| 59 scoped_ptr<net::URLRequestJobFactory> job_factory_; | 57 scoped_ptr<net::URLRequestJobFactory> job_factory_; |
| 60 scoped_ptr<net::HttpTransactionFactory> main_http_factory_; | 58 scoped_ptr<net::HttpTransactionFactory> main_http_factory_; |
| 61 | 59 |
| 62 // ProtocolHandlers are stored here between SetProtocolHandlers() and the | 60 // ProtocolHandlers are stored here between SetProtocolHandlers() and the |
| 63 // first GetURLRequestContext() call. | 61 // first GetURLRequestContext() call. |
| 64 content::ProtocolHandlerMap protocol_handlers_; | 62 content::ProtocolHandlerMap protocol_handlers_; |
| 65 | 63 |
| 66 DISALLOW_COPY_AND_ASSIGN(AwURLRequestContextGetter); | 64 DISALLOW_COPY_AND_ASSIGN(AwURLRequestContextGetter); |
| 67 }; | 65 }; |
| 68 | 66 |
| 69 } // namespace android_webview | 67 } // namespace android_webview |
| 70 | 68 |
| 71 #endif // ANDROID_WEBVIEW_BROWSER_NET_AW_URL_REQUEST_CONTEXT_GETTER_H_ | 69 #endif // ANDROID_WEBVIEW_BROWSER_NET_AW_URL_REQUEST_CONTEXT_GETTER_H_ |
| OLD | NEW |