OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_COMMON_NET_URL_REQUEST_CONTEXT_GETTER_H_ | 5 #ifndef CHROME_COMMON_NET_URL_REQUEST_CONTEXT_GETTER_H_ |
6 #define CHROME_COMMON_NET_URL_REQUEST_CONTEXT_GETTER_H_ | 6 #define CHROME_COMMON_NET_URL_REQUEST_CONTEXT_GETTER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/ref_counted.h" | 9 #include "base/ref_counted.h" |
10 #include "base/task.h" | 10 #include "base/task.h" |
11 | 11 |
12 namespace base { | 12 namespace base { |
13 class MessageLoopProxy; | 13 class MessageLoopProxy; |
14 } | 14 } |
15 | 15 |
16 namespace net { | 16 namespace net { |
17 class CookieStore; | 17 class CookieStore; |
| 18 class URLRequestContext; |
18 } | 19 } |
19 | 20 |
20 class URLRequestContext; | |
21 struct URLRequestContextGetterTraits; | 21 struct URLRequestContextGetterTraits; |
22 | 22 |
23 // Interface for retrieving an URLRequestContext. | 23 // Interface for retrieving an URLRequestContext. |
24 class URLRequestContextGetter | 24 class URLRequestContextGetter |
25 : public base::RefCountedThreadSafe<URLRequestContextGetter, | 25 : public base::RefCountedThreadSafe<URLRequestContextGetter, |
26 URLRequestContextGetterTraits> { | 26 URLRequestContextGetterTraits> { |
27 public: | 27 public: |
28 virtual URLRequestContext* GetURLRequestContext() = 0; | 28 virtual net::URLRequestContext* GetURLRequestContext() = 0; |
29 | 29 |
30 // Defaults to GetURLRequestContext()->cookie_store(), but | 30 // Defaults to GetURLRequestContext()->cookie_store(), but |
31 // implementations can override it. | 31 // implementations can override it. |
32 virtual net::CookieStore* GetCookieStore(); | 32 virtual net::CookieStore* GetCookieStore(); |
33 // Returns a MessageLoopProxy corresponding to the thread on which the | 33 // Returns a MessageLoopProxy corresponding to the thread on which the |
34 // request IO happens (the thread on which the returned URLRequestContext | 34 // request IO happens (the thread on which the returned URLRequestContext |
35 // may be used). | 35 // may be used). |
36 virtual scoped_refptr<base::MessageLoopProxy> | 36 virtual scoped_refptr<base::MessageLoopProxy> |
37 GetIOMessageLoopProxy() const = 0; | 37 GetIOMessageLoopProxy() const = 0; |
38 | 38 |
(...skipping 24 matching lines...) Expand all Loading... |
63 bool is_main_; | 63 bool is_main_; |
64 }; | 64 }; |
65 | 65 |
66 struct URLRequestContextGetterTraits { | 66 struct URLRequestContextGetterTraits { |
67 static void Destruct(const URLRequestContextGetter* context_getter) { | 67 static void Destruct(const URLRequestContextGetter* context_getter) { |
68 context_getter->OnDestruct(); | 68 context_getter->OnDestruct(); |
69 } | 69 } |
70 }; | 70 }; |
71 | 71 |
72 #endif // CHROME_COMMON_NET_URL_REQUEST_CONTEXT_GETTER_H_ | 72 #endif // CHROME_COMMON_NET_URL_REQUEST_CONTEXT_GETTER_H_ |
OLD | NEW |