Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Side by Side Diff: android_webview/browser/net/aw_url_request_context_getter.h

Issue 11308362: Add StoragePartition's ProtocolHandlers at URLRequestContext construction time. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync (r179907) Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
9 #include "base/compiler_specific.h"
10 #include "base/memory/scoped_ptr.h"
8 #include "content/public/browser/browser_thread_delegate.h" 11 #include "content/public/browser/browser_thread_delegate.h"
9
10 #include "base/memory/scoped_ptr.h"
11 #include "net/http/http_network_session.h" 12 #include "net/http/http_network_session.h"
12 #include "net/url_request/url_request_context_getter.h" 13 #include "net/url_request/url_request_context_getter.h"
13 14 #include "net/url_request/url_request_job_factory.h"
14 namespace content {
15 class ResourceContext;
16 }
17 15
18 namespace net { 16 namespace net {
19 class HttpTransactionFactory; 17 class HttpTransactionFactory;
20 class ProxyConfigService; 18 class ProxyConfigService;
21 class URLRequestContext; 19 class URLRequestContext;
22 class URLRequestJobFactory; 20 class URLRequestJobFactory;
23 } 21 }
24 22
25 namespace android_webview { 23 namespace android_webview {
26 24
27 class AwBrowserContext; 25 class AwBrowserContext;
28 class AwNetworkDelegate; 26 class AwNetworkDelegate;
29 27
30 class AwURLRequestContextGetter : public net::URLRequestContextGetter, 28 class AwURLRequestContextGetter : public net::URLRequestContextGetter,
31 public content::BrowserThreadDelegate { 29 public content::BrowserThreadDelegate {
32 public: 30 public:
33 AwURLRequestContextGetter(AwBrowserContext* browser_context); 31 AwURLRequestContextGetter(AwBrowserContext* browser_context);
awong 2013/02/02 03:26:12 Should this be explicit?
pauljensen 2013/02/04 14:18:54 Done.
34 32
35 void InitializeOnNetworkThread(); 33 void InitializeOnNetworkThread();
36 34
37 content::ResourceContext* GetResourceContext();
38
39 // content::BrowserThreadDelegate implementation. 35 // content::BrowserThreadDelegate implementation.
40 virtual void Init() OVERRIDE; 36 virtual void Init() OVERRIDE;
41 virtual void CleanUp() OVERRIDE {} 37 virtual void CleanUp() OVERRIDE {}
42 38
43 // net::URLRequestContextGetter implementation. 39 // net::URLRequestContextGetter implementation.
44 virtual net::URLRequestContext* GetURLRequestContext() OVERRIDE; 40 virtual net::URLRequestContext* GetURLRequestContext() OVERRIDE;
45 virtual scoped_refptr<base::SingleThreadTaskRunner> 41 virtual scoped_refptr<base::SingleThreadTaskRunner>
46 GetNetworkTaskRunner() const OVERRIDE; 42 GetNetworkTaskRunner() const OVERRIDE;
47 43
44 // Prior to GetURLRequestContext() being called, SetProtocolHandlers() is
awong 2013/02/02 03:26:12 Can we dump this in private and friend AwBrowserCo
pauljensen 2013/02/04 14:18:54 I could, but the style guide says friends are norm
awong 2013/02/05 02:57:11 Yah, I'd still friend it. Style guide doesn't ban
45 // called to hand over the ProtocolHandlers that GetURLRequestContext() will
46 // later install into |job_factory_|. This ordering is enforced by having
47 // AwBrowserContext::CreateRequestContext() call SetProtocolHandlers().
48 void SetProtocolHandlers(
49 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
50 blob_protocol_handler,
51 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
52 file_system_protocol_handler,
53 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
54 developer_protocol_handler,
55 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
56 chrome_protocol_handler,
57 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
58 chrome_devtools_protocol_handler);
59
48 private: 60 private:
49 virtual ~AwURLRequestContextGetter(); 61 virtual ~AwURLRequestContextGetter();
50 62
51 void PopulateNetworkSessionParams(net::HttpNetworkSession::Params* params); 63 void PopulateNetworkSessionParams(net::HttpNetworkSession::Params* params);
52 64
53 AwBrowserContext* browser_context_; // weak 65 AwBrowserContext* browser_context_; // weak
54 scoped_ptr<net::URLRequestContext> url_request_context_; 66 scoped_ptr<net::URLRequestContext> url_request_context_;
55 scoped_ptr<net::ProxyConfigService> proxy_config_service_; 67 scoped_ptr<net::ProxyConfigService> proxy_config_service_;
56 scoped_ptr<content::ResourceContext> resource_context_;
57 scoped_ptr<net::URLRequestJobFactory> job_factory_; 68 scoped_ptr<net::URLRequestJobFactory> job_factory_;
58 scoped_ptr<net::HttpTransactionFactory> main_http_factory_; 69 scoped_ptr<net::HttpTransactionFactory> main_http_factory_;
59 70
71 // ProtocolHandlers are stored here between SetProtocolHandlers() and
72 // GetURLRequestContext() calls.
73 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> blob_protocol_handler_;
74 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
75 file_system_protocol_handler_;
76 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
77 developer_protocol_handler_;
78 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
79 chrome_protocol_handler_;
80 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
81 chrome_devtools_protocol_handler_;
82
60 DISALLOW_COPY_AND_ASSIGN(AwURLRequestContextGetter); 83 DISALLOW_COPY_AND_ASSIGN(AwURLRequestContextGetter);
61 }; 84 };
62 85
63 } // namespace android_webview 86 } // namespace android_webview
64 87
65 #endif // ANDROID_WEBVIEW_BROWSER_NET_AW_URL_REQUEST_CONTEXT_GETTER_H_ 88 #endif // ANDROID_WEBVIEW_BROWSER_NET_AW_URL_REQUEST_CONTEXT_GETTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698