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