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