OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "chrome/browser/api/prefs/pref_change_registrar.h" | 11 #include "chrome/browser/api/prefs/pref_change_registrar.h" |
12 #include "content/public/browser/notification_observer.h" | 12 #include "content/public/browser/notification_observer.h" |
13 #include "content/public/browser/notification_registrar.h" | 13 #include "content/public/browser/notification_registrar.h" |
14 #include "net/url_request/url_request_context.h" | 14 #include "net/url_request/url_request_context.h" |
15 #include "net/url_request/url_request_context_getter.h" | 15 #include "net/url_request/url_request_context_getter.h" |
| 16 #include "net/url_request/url_request_job_factory.h" |
16 | 17 |
17 class ChromeURLDataManagerBackend; | 18 class ChromeURLDataManagerBackend; |
18 class ChromeURLRequestContextFactory; | 19 class ChromeURLRequestContextFactory; |
19 class IOThread; | 20 class IOThread; |
20 class Profile; | 21 class Profile; |
21 class ProfileIOData; | 22 class ProfileIOData; |
22 | 23 |
23 namespace chrome_browser_net { | 24 namespace chrome_browser_net { |
24 class LoadTimeStats; | 25 class LoadTimeStats; |
25 } | 26 } |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 // Create an instance for an original profile for extensions. This is expected | 138 // Create an instance for an original profile for extensions. This is expected |
138 // to get called on UI thread. | 139 // to get called on UI thread. |
139 static ChromeURLRequestContextGetter* CreateOriginalForExtensions( | 140 static ChromeURLRequestContextGetter* CreateOriginalForExtensions( |
140 Profile* profile, const ProfileIOData* profile_io_data); | 141 Profile* profile, const ProfileIOData* profile_io_data); |
141 | 142 |
142 // Create an instance for an original profile for an app with isolated | 143 // Create an instance for an original profile for an app with isolated |
143 // storage. This is expected to get called on UI thread. | 144 // storage. This is expected to get called on UI thread. |
144 static ChromeURLRequestContextGetter* CreateOriginalForIsolatedApp( | 145 static ChromeURLRequestContextGetter* CreateOriginalForIsolatedApp( |
145 Profile* profile, | 146 Profile* profile, |
146 const ProfileIOData* profile_io_data, | 147 const ProfileIOData* profile_io_data, |
147 const std::string& app_id); | 148 const std::string& app_id, |
| 149 scoped_ptr<net::URLRequestJobFactory::Interceptor> |
| 150 protocol_handler_interceptor); |
148 | 151 |
149 // Create an instance for an original profile for media with isolated | 152 // Create an instance for an original profile for media with isolated |
150 // storage. This is expected to get called on UI thread. | 153 // storage. This is expected to get called on UI thread. |
151 static ChromeURLRequestContextGetter* CreateOriginalForIsolatedMedia( | 154 static ChromeURLRequestContextGetter* CreateOriginalForIsolatedMedia( |
152 Profile* profile, | 155 Profile* profile, |
| 156 ChromeURLRequestContextGetter* app_context, |
153 const ProfileIOData* profile_io_data, | 157 const ProfileIOData* profile_io_data, |
154 const std::string& app_id); | 158 const std::string& app_id); |
155 | 159 |
156 // Create an instance for use with an OTR profile. This is expected to get | 160 // Create an instance for use with an OTR profile. This is expected to get |
157 // called on the UI thread. | 161 // called on the UI thread. |
158 static ChromeURLRequestContextGetter* CreateOffTheRecord( | 162 static ChromeURLRequestContextGetter* CreateOffTheRecord( |
159 Profile* profile, const ProfileIOData* profile_io_data); | 163 Profile* profile, const ProfileIOData* profile_io_data); |
160 | 164 |
161 // Create an instance for an OTR profile for extensions. This is expected | 165 // Create an instance for an OTR profile for extensions. This is expected |
162 // to get called on UI thread. | 166 // to get called on UI thread. |
163 static ChromeURLRequestContextGetter* CreateOffTheRecordForExtensions( | 167 static ChromeURLRequestContextGetter* CreateOffTheRecordForExtensions( |
164 Profile* profile, const ProfileIOData* profile_io_data); | 168 Profile* profile, const ProfileIOData* profile_io_data); |
165 | 169 |
166 // Create an instance for an OTR profile for an app with isolated storage. | 170 // Create an instance for an OTR profile for an app with isolated storage. |
167 // This is expected to get called on UI thread. | 171 // This is expected to get called on UI thread. |
168 static ChromeURLRequestContextGetter* CreateOffTheRecordForIsolatedApp( | 172 static ChromeURLRequestContextGetter* CreateOffTheRecordForIsolatedApp( |
169 Profile* profile, | 173 Profile* profile, |
170 const ProfileIOData* profile_io_data, | 174 const ProfileIOData* profile_io_data, |
171 const std::string& app_id); | 175 const std::string& app_id, |
| 176 scoped_ptr<net::URLRequestJobFactory::Interceptor> |
| 177 protocol_handler_interceptor); |
172 | 178 |
173 // Clean up UI thread resources. This is expected to get called on the UI | 179 // Clean up UI thread resources. This is expected to get called on the UI |
174 // thread before the instance is deleted on the IO thread. | 180 // thread before the instance is deleted on the IO thread. |
175 void CleanupOnUIThread(); | 181 void CleanupOnUIThread(); |
176 | 182 |
177 // content::NotificationObserver implementation. | 183 // content::NotificationObserver implementation. |
178 virtual void Observe(int type, | 184 virtual void Observe(int type, |
179 const content::NotificationSource& source, | 185 const content::NotificationSource& source, |
180 const content::NotificationDetails& details) OVERRIDE; | 186 const content::NotificationDetails& details) OVERRIDE; |
181 | 187 |
(...skipping 18 matching lines...) Expand all Loading... |
200 | 206 |
201 // NULL if not yet initialized. Otherwise, it is the ChromeURLRequestContext | 207 // NULL if not yet initialized. Otherwise, it is the ChromeURLRequestContext |
202 // instance that was lazily created by GetURLRequestContext(). | 208 // instance that was lazily created by GetURLRequestContext(). |
203 // Access only from the IO thread. | 209 // Access only from the IO thread. |
204 base::WeakPtr<ChromeURLRequestContext> url_request_context_; | 210 base::WeakPtr<ChromeURLRequestContext> url_request_context_; |
205 | 211 |
206 DISALLOW_COPY_AND_ASSIGN(ChromeURLRequestContextGetter); | 212 DISALLOW_COPY_AND_ASSIGN(ChromeURLRequestContextGetter); |
207 }; | 213 }; |
208 | 214 |
209 #endif // CHROME_BROWSER_NET_CHROME_URL_REQUEST_CONTEXT_H_ | 215 #endif // CHROME_BROWSER_NET_CHROME_URL_REQUEST_CONTEXT_H_ |
OLD | NEW |