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/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 17 matching lines...) Expand all Loading... | |
28 | 28 |
29 class AwURLRequestContextGetter : public net::URLRequestContextGetter, | 29 class AwURLRequestContextGetter : public net::URLRequestContextGetter, |
30 public content::BrowserThreadDelegate { | 30 public content::BrowserThreadDelegate { |
31 public: | 31 public: |
32 explicit AwURLRequestContextGetter(AwBrowserContext* browser_context); | 32 explicit AwURLRequestContextGetter(AwBrowserContext* browser_context); |
33 | 33 |
34 void InitializeOnNetworkThread(); | 34 void InitializeOnNetworkThread(); |
35 | 35 |
36 // content::BrowserThreadDelegate implementation. | 36 // content::BrowserThreadDelegate implementation. |
37 virtual void Init() OVERRIDE; | 37 virtual void Init() OVERRIDE; |
38 virtual void InitAsync() OVERRIDE; | |
38 virtual void CleanUp() OVERRIDE {} | 39 virtual void CleanUp() OVERRIDE {} |
39 | 40 |
40 // net::URLRequestContextGetter implementation. | 41 // net::URLRequestContextGetter implementation. |
41 virtual net::URLRequestContext* GetURLRequestContext() OVERRIDE; | 42 virtual net::URLRequestContext* GetURLRequestContext() OVERRIDE; |
42 virtual scoped_refptr<base::SingleThreadTaskRunner> | 43 virtual scoped_refptr<base::SingleThreadTaskRunner> |
43 GetNetworkTaskRunner() const OVERRIDE; | 44 GetNetworkTaskRunner() const OVERRIDE; |
44 | 45 |
45 private: | 46 private: |
46 friend class AwBrowserContext; | 47 friend class AwBrowserContext; |
47 | 48 |
48 virtual ~AwURLRequestContextGetter(); | 49 virtual ~AwURLRequestContextGetter(); |
49 | 50 |
50 // Prior to GetURLRequestContext() being called, SetProtocolHandlers() is | 51 // Prior to GetURLRequestContext() being called, SetProtocolHandlers() is |
51 // called to hand over the ProtocolHandlers that GetURLRequestContext() will | 52 // called to hand over the ProtocolHandlers that GetURLRequestContext() will |
52 // later install into |job_factory_|. This ordering is enforced by having | 53 // later install into |job_factory_|. This ordering is enforced by having |
53 // AwBrowserContext::CreateRequestContext() call SetProtocolHandlers(). | 54 // AwBrowserContext::CreateRequestContext() call SetProtocolHandlers(). |
54 // SetProtocolHandlers() is necessary because the ProtocolHandlers are created | 55 // SetProtocolHandlers() is necessary because the ProtocolHandlers are created |
55 // on the UI thread while |job_factory_| must be created on the IO thread. | 56 // on the UI thread while |job_factory_| must be created on the IO thread. |
56 void SetProtocolHandlers(content::ProtocolHandlerMap* protocol_handlers); | 57 void SetProtocolHandlers(content::ProtocolHandlerMap* protocol_handlers); |
57 | 58 |
58 void PopulateNetworkSessionParams(net::HttpNetworkSession::Params* params); | 59 void PopulateNetworkSessionParams(net::HttpNetworkSession::Params* params); |
59 | 60 |
60 AwBrowserContext* browser_context_; // weak | 61 AwBrowserContext* browser_context_; // weak |
62 scoped_refptr<net::CookieStore> cookie_store_; | |
Kristian Monsen
2013/07/16 20:04:09
It would be nice to be able to avoid creating this
joth
2013/07/16 20:19:52
agree to that -- comment would be good.
Or altern
| |
61 scoped_ptr<net::URLRequestContext> url_request_context_; | 63 scoped_ptr<net::URLRequestContext> url_request_context_; |
62 scoped_ptr<net::ProxyConfigService> proxy_config_service_; | 64 scoped_ptr<net::ProxyConfigService> proxy_config_service_; |
63 scoped_ptr<net::URLRequestJobFactory> job_factory_; | 65 scoped_ptr<net::URLRequestJobFactory> job_factory_; |
64 scoped_ptr<net::HttpTransactionFactory> main_http_factory_; | 66 scoped_ptr<net::HttpTransactionFactory> main_http_factory_; |
65 | 67 |
66 // ProtocolHandlers are stored here between SetProtocolHandlers() and the | 68 // ProtocolHandlers are stored here between SetProtocolHandlers() and the |
67 // first GetURLRequestContext() call. | 69 // first GetURLRequestContext() call. |
68 content::ProtocolHandlerMap protocol_handlers_; | 70 content::ProtocolHandlerMap protocol_handlers_; |
69 | 71 |
70 DISALLOW_COPY_AND_ASSIGN(AwURLRequestContextGetter); | 72 DISALLOW_COPY_AND_ASSIGN(AwURLRequestContextGetter); |
71 }; | 73 }; |
72 | 74 |
73 } // namespace android_webview | 75 } // namespace android_webview |
74 | 76 |
75 #endif // ANDROID_WEBVIEW_BROWSER_NET_AW_URL_REQUEST_CONTEXT_GETTER_H_ | 77 #endif // ANDROID_WEBVIEW_BROWSER_NET_AW_URL_REQUEST_CONTEXT_GETTER_H_ |
OLD | NEW |