OLD | NEW |
1 // Copyright (c) 2011 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_BROWSER_NET_CHROME_URL_REQUEST_CONTEXT_H_ | 5 #ifndef CHROME_BROWSER_NET_CHROME_URL_REQUEST_CONTEXT_H_ |
6 #define CHROME_BROWSER_NET_CHROME_URL_REQUEST_CONTEXT_H_ | 6 #define CHROME_BROWSER_NET_CHROME_URL_REQUEST_CONTEXT_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 23 matching lines...) Expand all Loading... |
34 public: | 34 public: |
35 ChromeURLRequestContext(); | 35 ChromeURLRequestContext(); |
36 | 36 |
37 // Copies the state from |other| into this context. | 37 // Copies the state from |other| into this context. |
38 void CopyFrom(ChromeURLRequestContext* other); | 38 void CopyFrom(ChromeURLRequestContext* other); |
39 | 39 |
40 bool is_incognito() const { | 40 bool is_incognito() const { |
41 return is_incognito_; | 41 return is_incognito_; |
42 } | 42 } |
43 | 43 |
44 virtual const std::string& GetUserAgent(const GURL& url) const; | 44 virtual const std::string& GetUserAgent(const GURL& url) const OVERRIDE; |
45 | 45 |
46 // TODO(willchan): Get rid of the need for this accessor. Really, this should | 46 // TODO(willchan): Get rid of the need for this accessor. Really, this should |
47 // move completely to ProfileIOData. | 47 // move completely to ProfileIOData. |
48 ChromeURLDataManagerBackend* chrome_url_data_manager_backend() const; | 48 ChromeURLDataManagerBackend* chrome_url_data_manager_backend() const; |
49 | 49 |
50 void set_is_incognito(bool is_incognito) { | 50 void set_is_incognito(bool is_incognito) { |
51 is_incognito_ = is_incognito; | 51 is_incognito_ = is_incognito; |
52 } | 52 } |
53 | 53 |
54 void set_chrome_url_data_manager_backend( | 54 void set_chrome_url_data_manager_backend( |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 // changes to charset/language and CleanupOnUIThread() will need to be | 95 // changes to charset/language and CleanupOnUIThread() will need to be |
96 // called to unregister. | 96 // called to unregister. |
97 ChromeURLRequestContextGetter(Profile* profile, | 97 ChromeURLRequestContextGetter(Profile* profile, |
98 ChromeURLRequestContextFactory* factory); | 98 ChromeURLRequestContextFactory* factory); |
99 | 99 |
100 // Note that GetURLRequestContext() can only be called from the IO | 100 // Note that GetURLRequestContext() can only be called from the IO |
101 // thread (it will assert otherwise). DONTUSEME_GetCookieStore() and | 101 // thread (it will assert otherwise). DONTUSEME_GetCookieStore() and |
102 // GetIOMessageLoopProxy however can be called from any thread. | 102 // GetIOMessageLoopProxy however can be called from any thread. |
103 // | 103 // |
104 // net::URLRequestContextGetter implementation. | 104 // net::URLRequestContextGetter implementation. |
105 virtual net::URLRequestContext* GetURLRequestContext(); | 105 virtual net::URLRequestContext* GetURLRequestContext() OVERRIDE; |
106 virtual net::CookieStore* DONTUSEME_GetCookieStore(); | 106 virtual net::CookieStore* DONTUSEME_GetCookieStore() OVERRIDE; |
107 virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() const; | 107 virtual scoped_refptr<base::MessageLoopProxy> |
| 108 GetIOMessageLoopProxy() const OVERRIDE; |
108 | 109 |
109 // Convenience overload of GetURLRequestContext() that returns a | 110 // Convenience overload of GetURLRequestContext() that returns a |
110 // ChromeURLRequestContext* rather than a net::URLRequestContext*. | 111 // ChromeURLRequestContext* rather than a net::URLRequestContext*. |
111 ChromeURLRequestContext* GetIOContext() { | 112 ChromeURLRequestContext* GetIOContext() { |
112 return reinterpret_cast<ChromeURLRequestContext*>(GetURLRequestContext()); | 113 return reinterpret_cast<ChromeURLRequestContext*>(GetURLRequestContext()); |
113 } | 114 } |
114 | 115 |
115 // Create an instance for use with an 'original' (non-OTR) profile. This is | 116 // Create an instance for use with an 'original' (non-OTR) profile. This is |
116 // expected to get called on the UI thread. | 117 // expected to get called on the UI thread. |
117 static ChromeURLRequestContextGetter* CreateOriginal( | 118 static ChromeURLRequestContextGetter* CreateOriginal( |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 const ProfileIOData* profile_io_data, | 153 const ProfileIOData* profile_io_data, |
153 const std::string& app_id); | 154 const std::string& app_id); |
154 | 155 |
155 // Clean up UI thread resources. This is expected to get called on the UI | 156 // Clean up UI thread resources. This is expected to get called on the UI |
156 // thread before the instance is deleted on the IO thread. | 157 // thread before the instance is deleted on the IO thread. |
157 void CleanupOnUIThread(); | 158 void CleanupOnUIThread(); |
158 | 159 |
159 // content::NotificationObserver implementation. | 160 // content::NotificationObserver implementation. |
160 virtual void Observe(int type, | 161 virtual void Observe(int type, |
161 const content::NotificationSource& source, | 162 const content::NotificationSource& source, |
162 const content::NotificationDetails& details); | 163 const content::NotificationDetails& details) OVERRIDE; |
163 | 164 |
164 private: | 165 private: |
165 // Must be called on the IO thread. | 166 // Must be called on the IO thread. |
166 virtual ~ChromeURLRequestContextGetter(); | 167 virtual ~ChromeURLRequestContextGetter(); |
167 | 168 |
168 // Registers an observer on |profile|'s preferences which will be used | 169 // Registers an observer on |profile|'s preferences which will be used |
169 // to update the context when the default language and charset change. | 170 // to update the context when the default language and charset change. |
170 void RegisterPrefsObserver(Profile* profile); | 171 void RegisterPrefsObserver(Profile* profile); |
171 | 172 |
172 // These methods simply forward to the corresponding method on | 173 // These methods simply forward to the corresponding method on |
(...skipping 18 matching lines...) Expand all Loading... |
191 | 192 |
192 // NULL if not yet initialized. Otherwise, it is the net::URLRequestContext | 193 // NULL if not yet initialized. Otherwise, it is the net::URLRequestContext |
193 // instance that was lazily created by GetURLRequestContext(). | 194 // instance that was lazily created by GetURLRequestContext(). |
194 // Access only from the IO thread. | 195 // Access only from the IO thread. |
195 base::WeakPtr<net::URLRequestContext> url_request_context_; | 196 base::WeakPtr<net::URLRequestContext> url_request_context_; |
196 | 197 |
197 DISALLOW_COPY_AND_ASSIGN(ChromeURLRequestContextGetter); | 198 DISALLOW_COPY_AND_ASSIGN(ChromeURLRequestContextGetter); |
198 }; | 199 }; |
199 | 200 |
200 #endif // CHROME_BROWSER_NET_CHROME_URL_REQUEST_CONTEXT_H_ | 201 #endif // CHROME_BROWSER_NET_CHROME_URL_REQUEST_CONTEXT_H_ |
OLD | NEW |