blob: 20857c728d0488b275372e0e4cebdbb5e934b311 [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
15namespace net {
16class URLRequestContextGetter;
17}
18
19namespace android_webview {
20
21class AwResourceContext : public content::ResourceContext {
22 public:
23 explicit AwResourceContext(net::URLRequestContextGetter* getter);
dcheng996c125c2015-02-04 02:25:4924 ~AwResourceContext() override;
[email protected]b05596b2013-12-10 18:43:2325
26 void SetExtraHeaders(const GURL& url, const std::string& headers);
27 std::string GetExtraHeaders(const GURL& url);
28
29 // content::ResourceContext implementation.
dcheng996c125c2015-02-04 02:25:4930 net::HostResolver* GetHostResolver() override;
31 net::URLRequestContext* GetRequestContext() override;
[email protected]b05596b2013-12-10 18:43:2332
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_