suppress unaddr error at WebResourceService::StartFetch
[chromium-blink-merge.git] / android_webview / browser / net / aw_url_request_context_getter.h
blob02eb74541d22afe8a064c77cd0bf52547ee9d9eb
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
3 // found in the LICENSE file.
5 #ifndef ANDROID_WEBVIEW_BROWSER_NET_AW_URL_REQUEST_CONTEXT_GETTER_H_
6 #define ANDROID_WEBVIEW_BROWSER_NET_AW_URL_REQUEST_CONTEXT_GETTER_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "base/files/file_path.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "content/public/browser/content_browser_client.h"
13 #include "net/http/http_network_session.h"
14 #include "net/url_request/url_request_context_getter.h"
15 #include "net/url_request/url_request_job_factory.h"
17 namespace net {
18 class CookieStore;
19 class HttpTransactionFactory;
20 class ProxyConfigService;
21 class URLRequestContext;
22 class URLRequestJobFactory;
25 namespace data_reduction_proxy {
26 class DataReductionProxyConfigService;
29 using data_reduction_proxy::DataReductionProxyConfigService;
31 namespace android_webview {
33 class AwNetworkDelegate;
35 class AwURLRequestContextGetter : public net::URLRequestContextGetter {
36 public:
37 AwURLRequestContextGetter(const base::FilePath& partition_path,
38 net::CookieStore* cookie_store);
40 void InitializeOnNetworkThread();
42 // net::URLRequestContextGetter implementation.
43 virtual net::URLRequestContext* GetURLRequestContext() OVERRIDE;
44 virtual scoped_refptr<base::SingleThreadTaskRunner>
45 GetNetworkTaskRunner() const OVERRIDE;
47 DataReductionProxyConfigService* proxy_config_service();
49 private:
50 friend class AwBrowserContext;
51 virtual ~AwURLRequestContextGetter();
53 // Prior to GetURLRequestContext() being called, this is called to hand over
54 // the objects that GetURLRequestContext() will later install into
55 // |job_factory_|. This ordering is enforced by having
56 // AwBrowserContext::CreateRequestContext() call this method.
57 // This method is necessary because the passed in objects are created
58 // on the UI thread while |job_factory_| must be created on the IO thread.
59 void SetHandlersAndInterceptors(
60 content::ProtocolHandlerMap* protocol_handlers,
61 content::URLRequestInterceptorScopedVector request_interceptors);
63 void InitializeURLRequestContext();
65 const base::FilePath partition_path_;
66 scoped_refptr<net::CookieStore> cookie_store_;
67 scoped_ptr<net::URLRequestContext> url_request_context_;
68 scoped_ptr<DataReductionProxyConfigService> proxy_config_service_;
69 scoped_ptr<net::URLRequestJobFactory> job_factory_;
70 scoped_ptr<net::HttpTransactionFactory> main_http_factory_;
72 // ProtocolHandlers and interceptors are stored here between
73 // SetHandlersAndInterceptors() and the first GetURLRequestContext() call.
74 content::ProtocolHandlerMap protocol_handlers_;
75 content::URLRequestInterceptorScopedVector request_interceptors_;
77 DISALLOW_COPY_AND_ASSIGN(AwURLRequestContextGetter);
80 } // namespace android_webview
82 #endif // ANDROID_WEBVIEW_BROWSER_NET_AW_URL_REQUEST_CONTEXT_GETTER_H_