[email protected] | b05596b | 2013-12-10 18:43:23 | [diff] [blame] | 1 | // Copyright 2013 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. |
| 4 | |
| 5 | #ifndef ANDROID_WEBVIEW_BROWSER_AW_RESOURCE_CONTEXT_H_ |
| 6 | #define ANDROID_WEBVIEW_BROWSER_AW_RESOURCE_CONTEXT_H_ |
| 7 | |
| 8 | #include <map> |
| 9 | #include <string> |
| 10 | |
avi | de7d5c2 | 2015-12-20 05:48:44 | [diff] [blame] | 11 | #include "base/macros.h" |
[email protected] | b05596b | 2013-12-10 18:43:23 | [diff] [blame] | 12 | #include "base/synchronization/lock.h" |
| 13 | #include "content/public/browser/resource_context.h" |
| 14 | |
rsleevi | 5d916f6c | 2016-12-21 22:39:41 | [diff] [blame^] | 15 | class GURL; |
| 16 | |
[email protected] | b05596b | 2013-12-10 18:43:23 | [diff] [blame] | 17 | namespace net { |
| 18 | class URLRequestContextGetter; |
| 19 | } |
| 20 | |
| 21 | namespace android_webview { |
| 22 | |
| 23 | class AwResourceContext : public content::ResourceContext { |
| 24 | public: |
| 25 | explicit AwResourceContext(net::URLRequestContextGetter* getter); |
dcheng | 996c125c | 2015-02-04 02:25:49 | [diff] [blame] | 26 | ~AwResourceContext() override; |
[email protected] | b05596b | 2013-12-10 18:43:23 | [diff] [blame] | 27 | |
| 28 | void SetExtraHeaders(const GURL& url, const std::string& headers); |
| 29 | std::string GetExtraHeaders(const GURL& url); |
| 30 | |
| 31 | // content::ResourceContext implementation. |
dcheng | 996c125c | 2015-02-04 02:25:49 | [diff] [blame] | 32 | net::HostResolver* GetHostResolver() override; |
| 33 | net::URLRequestContext* GetRequestContext() override; |
[email protected] | b05596b | 2013-12-10 18:43:23 | [diff] [blame] | 34 | |
| 35 | private: |
| 36 | net::URLRequestContextGetter* getter_; |
| 37 | |
| 38 | base::Lock extra_headers_lock_; |
| 39 | std::map<std::string, std::string> extra_headers_; |
| 40 | |
| 41 | DISALLOW_COPY_AND_ASSIGN(AwResourceContext); |
| 42 | }; |
| 43 | |
| 44 | } // namespace android_webview |
| 45 | |
| 46 | #endif // ANDROID_WEBVIEW_BROWSER_AW_RESOURCE_CONTEXT_H_ |