OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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" |
(...skipping 17 matching lines...) Expand all Loading... |
28 virtual URLRequestContext* GetURLRequestContext() = 0; | 28 virtual 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> GetIOMessageLoopProxy() = 0; | 36 virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() = 0; |
37 | 37 |
| 38 // Controls whether or not the URLRequestContextGetter considers itself to be |
| 39 // the the "main" URLRequestContextGetter. Note that each Profile will have a |
| 40 // "default" URLRequestContextGetter. Therefore, "is_main" refers to the |
| 41 // default URLRequestContextGetter for the "main" Profile. |
| 42 // TODO(willchan): Move this code to ChromeURLRequestContextGetter, since this |
| 43 // ia a browser process specific concept. |
| 44 void set_is_main(bool is_main) { is_main_ = is_main; } |
| 45 |
38 protected: | 46 protected: |
39 friend class DeleteTask<URLRequestContextGetter>; | 47 friend class DeleteTask<URLRequestContextGetter>; |
40 friend struct URLRequestContextGetterTraits; | 48 friend struct URLRequestContextGetterTraits; |
41 | 49 |
| 50 URLRequestContextGetter() : is_main_(false) {} |
| 51 |
42 virtual ~URLRequestContextGetter() {} | 52 virtual ~URLRequestContextGetter() {} |
| 53 |
| 54 bool is_main() const { return is_main_; } |
| 55 |
43 private: | 56 private: |
44 // OnDestruct is meant to ensure deletion on the thread on which the request | 57 // OnDestruct is meant to ensure deletion on the thread on which the request |
45 // IO happens. | 58 // IO happens. |
46 void OnDestruct(); | 59 void OnDestruct(); |
| 60 |
| 61 // Indicates whether or not this is the default URLRequestContextGetter for |
| 62 // the main Profile. |
| 63 bool is_main_; |
47 }; | 64 }; |
48 | 65 |
49 struct URLRequestContextGetterTraits { | 66 struct URLRequestContextGetterTraits { |
50 static void Destruct(URLRequestContextGetter* context_getter) { | 67 static void Destruct(URLRequestContextGetter* context_getter) { |
51 context_getter->OnDestruct(); | 68 context_getter->OnDestruct(); |
52 } | 69 } |
53 }; | 70 }; |
54 | 71 |
55 #endif // CHROME_COMMON_NET_URL_REQUEST_CONTEXT_GETTER_H_ | 72 #endif // CHROME_COMMON_NET_URL_REQUEST_CONTEXT_GETTER_H_ |
56 | |
OLD | NEW |