| 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 | |
| 46 protected: | 38 protected: |
| 47 friend class DeleteTask<URLRequestContextGetter>; | 39 friend class DeleteTask<URLRequestContextGetter>; |
| 48 friend struct URLRequestContextGetterTraits; | 40 friend struct URLRequestContextGetterTraits; |
| 49 | 41 |
| 50 URLRequestContextGetter() : is_main_(false) {} | |
| 51 | |
| 52 virtual ~URLRequestContextGetter() {} | 42 virtual ~URLRequestContextGetter() {} |
| 53 | |
| 54 bool is_main() const { return is_main_; } | |
| 55 | |
| 56 private: | 43 private: |
| 57 // OnDestruct is meant to ensure deletion on the thread on which the request | 44 // OnDestruct is meant to ensure deletion on the thread on which the request |
| 58 // IO happens. | 45 // IO happens. |
| 59 void OnDestruct(); | 46 void OnDestruct(); |
| 60 | |
| 61 // Indicates whether or not this is the default URLRequestContextGetter for | |
| 62 // the main Profile. | |
| 63 bool is_main_; | |
| 64 }; | 47 }; |
| 65 | 48 |
| 66 struct URLRequestContextGetterTraits { | 49 struct URLRequestContextGetterTraits { |
| 67 static void Destruct(URLRequestContextGetter* context_getter) { | 50 static void Destruct(URLRequestContextGetter* context_getter) { |
| 68 context_getter->OnDestruct(); | 51 context_getter->OnDestruct(); |
| 69 } | 52 } |
| 70 }; | 53 }; |
| 71 | 54 |
| 72 #endif // CHROME_COMMON_NET_URL_REQUEST_CONTEXT_GETTER_H_ | 55 #endif // CHROME_COMMON_NET_URL_REQUEST_CONTEXT_GETTER_H_ |
| 56 |
| OLD | NEW |