| 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" |
| 11 #include "content/public/browser/browser_thread_delegate.h" | 11 #include "content/public/browser/browser_thread_delegate.h" |
| 12 #include "content/public/browser/content_browser_client.h" |
| 12 #include "net/http/http_network_session.h" | 13 #include "net/http/http_network_session.h" |
| 13 #include "net/url_request/url_request_context_getter.h" | 14 #include "net/url_request/url_request_context_getter.h" |
| 14 #include "net/url_request/url_request_job_factory.h" | 15 #include "net/url_request/url_request_job_factory.h" |
| 15 | 16 |
| 16 namespace net { | 17 namespace net { |
| 17 class HttpTransactionFactory; | 18 class HttpTransactionFactory; |
| 18 class ProxyConfigService; | 19 class ProxyConfigService; |
| 19 class URLRequestContext; | 20 class URLRequestContext; |
| 20 class URLRequestJobFactory; | 21 class URLRequestJobFactory; |
| 21 } | 22 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 45 friend class AwBrowserContext; | 46 friend class AwBrowserContext; |
| 46 | 47 |
| 47 virtual ~AwURLRequestContextGetter(); | 48 virtual ~AwURLRequestContextGetter(); |
| 48 | 49 |
| 49 // Prior to GetURLRequestContext() being called, SetProtocolHandlers() is | 50 // Prior to GetURLRequestContext() being called, SetProtocolHandlers() is |
| 50 // called to hand over the ProtocolHandlers that GetURLRequestContext() will | 51 // called to hand over the ProtocolHandlers that GetURLRequestContext() will |
| 51 // later install into |job_factory_|. This ordering is enforced by having | 52 // later install into |job_factory_|. This ordering is enforced by having |
| 52 // AwBrowserContext::CreateRequestContext() call SetProtocolHandlers(). | 53 // AwBrowserContext::CreateRequestContext() call SetProtocolHandlers(). |
| 53 // SetProtocolHandlers() is necessary because the ProtocolHandlers are created | 54 // SetProtocolHandlers() is necessary because the ProtocolHandlers are created |
| 54 // on the UI thread while |job_factory_| must be created on the IO thread. | 55 // on the UI thread while |job_factory_| must be created on the IO thread. |
| 55 void SetProtocolHandlers( | 56 void SetProtocolHandlers(content::ProtocolHandlerMap* protocol_handlers); |
| 56 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
| 57 blob_protocol_handler, | |
| 58 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
| 59 file_system_protocol_handler, | |
| 60 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
| 61 developer_protocol_handler, | |
| 62 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
| 63 chrome_protocol_handler, | |
| 64 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
| 65 chrome_devtools_protocol_handler); | |
| 66 | 57 |
| 67 void PopulateNetworkSessionParams(net::HttpNetworkSession::Params* params); | 58 void PopulateNetworkSessionParams(net::HttpNetworkSession::Params* params); |
| 68 | 59 |
| 69 AwBrowserContext* browser_context_; // weak | 60 AwBrowserContext* browser_context_; // weak |
| 70 scoped_ptr<net::URLRequestContext> url_request_context_; | 61 scoped_ptr<net::URLRequestContext> url_request_context_; |
| 71 scoped_ptr<net::ProxyConfigService> proxy_config_service_; | 62 scoped_ptr<net::ProxyConfigService> proxy_config_service_; |
| 72 scoped_ptr<net::URLRequestJobFactory> job_factory_; | 63 scoped_ptr<net::URLRequestJobFactory> job_factory_; |
| 73 scoped_ptr<net::HttpTransactionFactory> main_http_factory_; | 64 scoped_ptr<net::HttpTransactionFactory> main_http_factory_; |
| 74 | 65 |
| 75 // ProtocolHandlers are stored here between SetProtocolHandlers() and the | 66 // ProtocolHandlers are stored here between SetProtocolHandlers() and the |
| 76 // first GetURLRequestContext() call. | 67 // first GetURLRequestContext() call. |
| 77 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> blob_protocol_handler_; | 68 content::ProtocolHandlerMap protocol_handlers_; |
| 78 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
| 79 file_system_protocol_handler_; | |
| 80 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
| 81 developer_protocol_handler_; | |
| 82 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
| 83 chrome_protocol_handler_; | |
| 84 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
| 85 chrome_devtools_protocol_handler_; | |
| 86 | 69 |
| 87 DISALLOW_COPY_AND_ASSIGN(AwURLRequestContextGetter); | 70 DISALLOW_COPY_AND_ASSIGN(AwURLRequestContextGetter); |
| 88 }; | 71 }; |
| 89 | 72 |
| 90 } // namespace android_webview | 73 } // namespace android_webview |
| 91 | 74 |
| 92 #endif // ANDROID_WEBVIEW_BROWSER_NET_AW_URL_REQUEST_CONTEXT_GETTER_H_ | 75 #endif // ANDROID_WEBVIEW_BROWSER_NET_AW_URL_REQUEST_CONTEXT_GETTER_H_ |
| OLD | NEW |