blob: 5763b17f7d02da0174fdf937e9dc7cdc136a7bad [file] [log] [blame]
[email protected]b05596b2013-12-10 18:43:231// 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
avide7d5c22015-12-20 05:48:4411#include "base/macros.h"
[email protected]b05596b2013-12-10 18:43:2312#include "base/synchronization/lock.h"
13#include "content/public/browser/resource_context.h"
14
rsleevi5d916f6c2016-12-21 22:39:4115class GURL;
16
[email protected]b05596b2013-12-10 18:43:2317namespace net {
18class URLRequestContextGetter;
19}
20
21namespace android_webview {
22
23class AwResourceContext : public content::ResourceContext {
24 public:
25 explicit AwResourceContext(net::URLRequestContextGetter* getter);
dcheng996c125c2015-02-04 02:25:4926 ~AwResourceContext() override;
[email protected]b05596b2013-12-10 18:43:2327
28 void SetExtraHeaders(const GURL& url, const std::string& headers);
29 std::string GetExtraHeaders(const GURL& url);
30
31 // content::ResourceContext implementation.
dcheng996c125c2015-02-04 02:25:4932 net::HostResolver* GetHostResolver() override;
33 net::URLRequestContext* GetRequestContext() override;
[email protected]b05596b2013-12-10 18:43:2334
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_