summaryrefslogtreecommitdiffstats
path: root/android_webview/browser/net/aw_url_request_context_getter.h
blob: 888ac08681dbe661767ef085c0532765c92e9e80 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef ANDROID_WEBVIEW_BROWSER_NET_AW_URL_REQUEST_CONTEXT_GETTER_H_
#define ANDROID_WEBVIEW_BROWSER_NET_AW_URL_REQUEST_CONTEXT_GETTER_H_

#include "content/public/browser/browser_thread_delegate.h"

#include "base/memory/scoped_ptr.h"
#include "net/url_request/url_request_context_getter.h"

namespace content {
class ResourceContext;
}

namespace net {
class ProxyConfigService;
class URLRequestContext;
class URLRequestJobFactory;
}

namespace android_webview {

class AwBrowserContext;
class AwNetworkDelegate;

class AwURLRequestContextGetter : public net::URLRequestContextGetter,
                                  public content::BrowserThreadDelegate {
 public:
  AwURLRequestContextGetter(AwBrowserContext* browser_context);

  void InitializeOnNetworkThread();

  content::ResourceContext* GetResourceContext();

  // content::BrowserThreadDelegate implementation.
  virtual void Init() OVERRIDE;
  virtual void CleanUp() OVERRIDE {}

  // net::URLRequestContextGetter implementation.
  virtual net::URLRequestContext* GetURLRequestContext() OVERRIDE;
  virtual scoped_refptr<base::SingleThreadTaskRunner>
      GetNetworkTaskRunner() const OVERRIDE;

 private:
  virtual ~AwURLRequestContextGetter();

  AwBrowserContext* browser_context_;  // weak
  scoped_ptr<net::URLRequestContext> url_request_context_;
  scoped_ptr<net::ProxyConfigService> proxy_config_service_;
  scoped_ptr<content::ResourceContext> resource_context_;
  scoped_ptr<net::URLRequestJobFactory> job_factory_;

  DISALLOW_COPY_AND_ASSIGN(AwURLRequestContextGetter);
};

}  // namespace android_webview

#endif  // ANDROID_WEBVIEW_BROWSER_NET_AW_URL_REQUEST_CONTEXT_GETTER_H_