Add a function to create a bookmark app from a WebApplicationInfo.
[chromium-blink-merge.git] / net / url_request / url_request_context_getter.h
blob4c8e4af55c3b8257044c480ec8fb124a2b530515
1 // Copyright (c) 2012 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.
5 #ifndef CHROME_COMMON_NET_URL_REQUEST_CONTEXT_GETTER_H_
6 #define CHROME_COMMON_NET_URL_REQUEST_CONTEXT_GETTER_H_
8 #include "base/memory/ref_counted.h"
9 #include "base/sequenced_task_runner_helpers.h"
10 #include "net/base/net_export.h"
12 namespace base {
13 class SingleThreadTaskRunner;
14 } // namespace base
16 namespace net {
17 class CookieStore;
18 class URLRequestContext;
20 struct URLRequestContextGetterTraits;
22 // Interface for retrieving an net::URLRequestContext.
23 class NET_EXPORT URLRequestContextGetter
24 : public base::RefCountedThreadSafe<URLRequestContextGetter,
25 URLRequestContextGetterTraits> {
26 public:
27 virtual URLRequestContext* GetURLRequestContext() = 0;
29 // Returns a SingleThreadTaskRunner corresponding to the thread on
30 // which the network IO happens (the thread on which the returned
31 // net::URLRequestContext may be used).
32 virtual scoped_refptr<base::SingleThreadTaskRunner>
33 GetNetworkTaskRunner() const = 0;
35 protected:
36 friend class base::RefCountedThreadSafe<URLRequestContextGetter,
37 URLRequestContextGetterTraits>;
38 friend class base::DeleteHelper<URLRequestContextGetter>;
39 friend struct URLRequestContextGetterTraits;
41 URLRequestContextGetter();
42 virtual ~URLRequestContextGetter();
44 private:
45 // OnDestruct is meant to ensure deletion on the thread on which the request
46 // IO happens.
47 void OnDestruct() const;
50 struct URLRequestContextGetterTraits {
51 static void Destruct(const URLRequestContextGetter* context_getter) {
52 context_getter->OnDestruct();
56 } // namespace net
58 #endif // CHROME_COMMON_NET_URL_REQUEST_CONTEXT_GETTER_H_