Chromium Code Reviews| 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 "base/prefs/public/pref_change_registrar.h" | 11 #include "base/prefs/public/pref_change_registrar.h" |
| 12 #include "chrome/browser/profiles/storage_partition_descriptor.h" | |
|
mmenke
2012/10/30 18:27:15
This shouldn't be needed, with the forward declara
nasko
2012/10/30 19:55:25
Done.
| |
| 12 #include "content/public/browser/notification_observer.h" | 13 #include "content/public/browser/notification_observer.h" |
| 13 #include "content/public/browser/notification_registrar.h" | 14 #include "content/public/browser/notification_registrar.h" |
| 14 #include "net/url_request/url_request_context.h" | 15 #include "net/url_request/url_request_context.h" |
| 15 #include "net/url_request/url_request_context_getter.h" | 16 #include "net/url_request/url_request_context_getter.h" |
| 16 #include "net/url_request/url_request_job_factory.h" | 17 #include "net/url_request/url_request_job_factory.h" |
| 17 | 18 |
| 18 class ChromeURLDataManagerBackend; | 19 class ChromeURLDataManagerBackend; |
| 19 class ChromeURLRequestContextFactory; | 20 class ChromeURLRequestContextFactory; |
| 20 class IOThread; | 21 class IOThread; |
| 21 class Profile; | 22 class Profile; |
| 22 class ProfileIOData; | 23 class ProfileIOData; |
| 24 struct StoragePartitionDescriptor; | |
| 23 | 25 |
| 24 namespace chrome_browser_net { | 26 namespace chrome_browser_net { |
| 25 class LoadTimeStats; | 27 class LoadTimeStats; |
| 26 } | 28 } |
| 27 | 29 |
| 28 // Subclass of net::URLRequestContext which can be used to store extra | 30 // Subclass of net::URLRequestContext which can be used to store extra |
| 29 // information for requests. | 31 // information for requests. |
| 30 // | 32 // |
| 31 // All methods of this class must be called from the IO thread, | 33 // All methods of this class must be called from the IO thread, |
| 32 // including the constructor and destructor. | 34 // including the constructor and destructor. |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 138 // Create an instance for an original profile for extensions. This is expected | 140 // Create an instance for an original profile for extensions. This is expected |
| 139 // to get called on UI thread. | 141 // to get called on UI thread. |
| 140 static ChromeURLRequestContextGetter* CreateOriginalForExtensions( | 142 static ChromeURLRequestContextGetter* CreateOriginalForExtensions( |
| 141 Profile* profile, const ProfileIOData* profile_io_data); | 143 Profile* profile, const ProfileIOData* profile_io_data); |
| 142 | 144 |
| 143 // Create an instance for an original profile for an app with isolated | 145 // Create an instance for an original profile for an app with isolated |
| 144 // storage. This is expected to get called on UI thread. | 146 // storage. This is expected to get called on UI thread. |
| 145 static ChromeURLRequestContextGetter* CreateOriginalForIsolatedApp( | 147 static ChromeURLRequestContextGetter* CreateOriginalForIsolatedApp( |
| 146 Profile* profile, | 148 Profile* profile, |
| 147 const ProfileIOData* profile_io_data, | 149 const ProfileIOData* profile_io_data, |
| 148 const std::string& app_id, | 150 const StoragePartitionDescriptor& partition_descriptor, |
| 149 scoped_ptr<net::URLRequestJobFactory::Interceptor> | 151 scoped_ptr<net::URLRequestJobFactory::Interceptor> |
| 150 protocol_handler_interceptor); | 152 protocol_handler_interceptor); |
| 151 | 153 |
| 152 // Create an instance for an original profile for media with isolated | 154 // Create an instance for an original profile for media with isolated |
| 153 // storage. This is expected to get called on UI thread. | 155 // storage. This is expected to get called on UI thread. |
| 154 static ChromeURLRequestContextGetter* CreateOriginalForIsolatedMedia( | 156 static ChromeURLRequestContextGetter* CreateOriginalForIsolatedMedia( |
| 155 Profile* profile, | 157 Profile* profile, |
| 156 ChromeURLRequestContextGetter* app_context, | 158 ChromeURLRequestContextGetter* app_context, |
| 157 const ProfileIOData* profile_io_data, | 159 const ProfileIOData* profile_io_data, |
| 158 const std::string& app_id); | 160 const StoragePartitionDescriptor& partition_descriptor); |
| 159 | 161 |
| 160 // Create an instance for use with an OTR profile. This is expected to get | 162 // Create an instance for use with an OTR profile. This is expected to get |
| 161 // called on the UI thread. | 163 // called on the UI thread. |
| 162 static ChromeURLRequestContextGetter* CreateOffTheRecord( | 164 static ChromeURLRequestContextGetter* CreateOffTheRecord( |
| 163 Profile* profile, const ProfileIOData* profile_io_data); | 165 Profile* profile, const ProfileIOData* profile_io_data); |
| 164 | 166 |
| 165 // Create an instance for an OTR profile for extensions. This is expected | 167 // Create an instance for an OTR profile for extensions. This is expected |
| 166 // to get called on UI thread. | 168 // to get called on UI thread. |
| 167 static ChromeURLRequestContextGetter* CreateOffTheRecordForExtensions( | 169 static ChromeURLRequestContextGetter* CreateOffTheRecordForExtensions( |
| 168 Profile* profile, const ProfileIOData* profile_io_data); | 170 Profile* profile, const ProfileIOData* profile_io_data); |
| 169 | 171 |
| 170 // Create an instance for an OTR profile for an app with isolated storage. | 172 // Create an instance for an OTR profile for an app with isolated storage. |
| 171 // This is expected to get called on UI thread. | 173 // This is expected to get called on UI thread. |
| 172 static ChromeURLRequestContextGetter* CreateOffTheRecordForIsolatedApp( | 174 static ChromeURLRequestContextGetter* CreateOffTheRecordForIsolatedApp( |
| 173 Profile* profile, | 175 Profile* profile, |
| 174 const ProfileIOData* profile_io_data, | 176 const ProfileIOData* profile_io_data, |
| 175 const std::string& app_id, | 177 const StoragePartitionDescriptor& partition_descriptor, |
| 176 scoped_ptr<net::URLRequestJobFactory::Interceptor> | 178 scoped_ptr<net::URLRequestJobFactory::Interceptor> |
| 177 protocol_handler_interceptor); | 179 protocol_handler_interceptor); |
| 178 | 180 |
| 179 // Clean up UI thread resources. This is expected to get called on the UI | 181 // Clean up UI thread resources. This is expected to get called on the UI |
| 180 // thread before the instance is deleted on the IO thread. | 182 // thread before the instance is deleted on the IO thread. |
| 181 void CleanupOnUIThread(); | 183 void CleanupOnUIThread(); |
| 182 | 184 |
| 183 // content::NotificationObserver implementation. | 185 // content::NotificationObserver implementation. |
| 184 virtual void Observe(int type, | 186 virtual void Observe(int type, |
| 185 const content::NotificationSource& source, | 187 const content::NotificationSource& source, |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 206 | 208 |
| 207 // NULL if not yet initialized. Otherwise, it is the ChromeURLRequestContext | 209 // NULL if not yet initialized. Otherwise, it is the ChromeURLRequestContext |
| 208 // instance that was lazily created by GetURLRequestContext(). | 210 // instance that was lazily created by GetURLRequestContext(). |
| 209 // Access only from the IO thread. | 211 // Access only from the IO thread. |
| 210 base::WeakPtr<ChromeURLRequestContext> url_request_context_; | 212 base::WeakPtr<ChromeURLRequestContext> url_request_context_; |
| 211 | 213 |
| 212 DISALLOW_COPY_AND_ASSIGN(ChromeURLRequestContextGetter); | 214 DISALLOW_COPY_AND_ASSIGN(ChromeURLRequestContextGetter); |
| 213 }; | 215 }; |
| 214 | 216 |
| 215 #endif // CHROME_BROWSER_NET_CHROME_URL_REQUEST_CONTEXT_H_ | 217 #endif // CHROME_BROWSER_NET_CHROME_URL_REQUEST_CONTEXT_H_ |
| OLD | NEW |