[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 | |
| 15 | namespace net { |
| 16 | class URLRequestContextGetter; |
| 17 | } |
| 18 | |
| 19 | namespace android_webview { |
| 20 | |
| 21 | class AwResourceContext : public content::ResourceContext { |
| 22 | public: |
| 23 | explicit AwResourceContext(net::URLRequestContextGetter* getter); |
dcheng | 996c125c | 2015-02-04 02:25:49 | [diff] [blame] | 24 | ~AwResourceContext() override; |
[email protected] | b05596b | 2013-12-10 18:43:23 | [diff] [blame] | 25 | |
| 26 | void SetExtraHeaders(const GURL& url, const std::string& headers); |
| 27 | std::string GetExtraHeaders(const GURL& url); |
| 28 | |
| 29 | // content::ResourceContext implementation. |
dcheng | 996c125c | 2015-02-04 02:25:49 | [diff] [blame] | 30 | net::HostResolver* GetHostResolver() override; |
| 31 | net::URLRequestContext* GetRequestContext() override; |
[email protected] | b05596b | 2013-12-10 18:43:23 | [diff] [blame] | 32 | |
| 33 | private: |
| 34 | net::URLRequestContextGetter* getter_; |
| 35 | |
| 36 | base::Lock extra_headers_lock_; |
| 37 | std::map<std::string, std::string> extra_headers_; |
| 38 | |
| 39 | DISALLOW_COPY_AND_ASSIGN(AwResourceContext); |
| 40 | }; |
| 41 | |
| 42 | } // namespace android_webview |
| 43 | |
| 44 | #endif // ANDROID_WEBVIEW_BROWSER_AW_RESOURCE_CONTEXT_H_ |