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/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 26 class AwBrowserContext; | 26 class AwBrowserContext; |
| 27 class AwNetworkDelegate; | 27 class AwNetworkDelegate; |
| 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 // must be called prior to Init() and contain the minimum amount of code | |
|
awong
2013/07/11 20:43:48
Please use correct capitalization and punctuation
| |
| 37 // that needs to happen synchronously to UI initialization | |
| 38 void InitializeOnUiThread(); | |
| 39 | |
| 36 // content::BrowserThreadDelegate implementation. | 40 // content::BrowserThreadDelegate implementation. |
| 37 virtual void Init() OVERRIDE; | 41 virtual void Init() OVERRIDE; |
| 38 virtual void CleanUp() OVERRIDE {} | 42 virtual void CleanUp() OVERRIDE {} |
| 39 | 43 |
| 40 // net::URLRequestContextGetter implementation. | 44 // net::URLRequestContextGetter implementation. |
| 41 virtual net::URLRequestContext* GetURLRequestContext() OVERRIDE; | 45 virtual net::URLRequestContext* GetURLRequestContext() OVERRIDE; |
| 42 virtual scoped_refptr<base::SingleThreadTaskRunner> | 46 virtual scoped_refptr<base::SingleThreadTaskRunner> |
| 43 GetNetworkTaskRunner() const OVERRIDE; | 47 GetNetworkTaskRunner() const OVERRIDE; |
| 44 | 48 |
| 45 private: | 49 private: |
| 46 friend class AwBrowserContext; | 50 friend class AwBrowserContext; |
| 47 | 51 |
| 48 virtual ~AwURLRequestContextGetter(); | 52 virtual ~AwURLRequestContextGetter(); |
| 49 | 53 |
| 50 // Prior to GetURLRequestContext() being called, SetProtocolHandlers() is | 54 // Prior to GetURLRequestContext() being called, SetProtocolHandlers() is |
| 51 // called to hand over the ProtocolHandlers that GetURLRequestContext() will | 55 // called to hand over the ProtocolHandlers that GetURLRequestContext() will |
| 52 // later install into |job_factory_|. This ordering is enforced by having | 56 // later install into |job_factory_|. This ordering is enforced by having |
| 53 // AwBrowserContext::CreateRequestContext() call SetProtocolHandlers(). | 57 // AwBrowserContext::CreateRequestContext() call SetProtocolHandlers(). |
| 54 // SetProtocolHandlers() is necessary because the ProtocolHandlers are created | 58 // SetProtocolHandlers() is necessary because the ProtocolHandlers are created |
| 55 // on the UI thread while |job_factory_| must be created on the IO thread. | 59 // on the UI thread while |job_factory_| must be created on the IO thread. |
| 56 void SetProtocolHandlers(content::ProtocolHandlerMap* protocol_handlers); | 60 void SetProtocolHandlers(content::ProtocolHandlerMap* protocol_handlers); |
| 57 | 61 |
| 58 void PopulateNetworkSessionParams(net::HttpNetworkSession::Params* params); | 62 void PopulateNetworkSessionParams(net::HttpNetworkSession::Params* params); |
| 59 | 63 |
| 60 AwBrowserContext* browser_context_; // weak | 64 AwBrowserContext* browser_context_; // weak |
| 65 scoped_refptr<net::CookieStore> cookie_store_; | |
| 61 scoped_ptr<net::URLRequestContext> url_request_context_; | 66 scoped_ptr<net::URLRequestContext> url_request_context_; |
| 62 scoped_ptr<net::ProxyConfigService> proxy_config_service_; | 67 scoped_ptr<net::ProxyConfigService> proxy_config_service_; |
| 63 scoped_ptr<net::URLRequestJobFactory> job_factory_; | 68 scoped_ptr<net::URLRequestJobFactory> job_factory_; |
| 64 scoped_ptr<net::HttpTransactionFactory> main_http_factory_; | 69 scoped_ptr<net::HttpTransactionFactory> main_http_factory_; |
| 65 | 70 |
| 66 // ProtocolHandlers are stored here between SetProtocolHandlers() and the | 71 // ProtocolHandlers are stored here between SetProtocolHandlers() and the |
| 67 // first GetURLRequestContext() call. | 72 // first GetURLRequestContext() call. |
| 68 content::ProtocolHandlerMap protocol_handlers_; | 73 content::ProtocolHandlerMap protocol_handlers_; |
| 69 | 74 |
| 70 DISALLOW_COPY_AND_ASSIGN(AwURLRequestContextGetter); | 75 DISALLOW_COPY_AND_ASSIGN(AwURLRequestContextGetter); |
| 71 }; | 76 }; |
| 72 | 77 |
| 73 } // namespace android_webview | 78 } // namespace android_webview |
| 74 | 79 |
| 75 #endif // ANDROID_WEBVIEW_BROWSER_NET_AW_URL_REQUEST_CONTEXT_GETTER_H_ | 80 #endif // ANDROID_WEBVIEW_BROWSER_NET_AW_URL_REQUEST_CONTEXT_GETTER_H_ |
| OLD | NEW |