| 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" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 // Create an instance for use with an 'original' (non-OTR) profile. This is | 96 // Create an instance for use with an 'original' (non-OTR) profile. This is |
| 97 // expected to get called on the UI thread. | 97 // expected to get called on the UI thread. |
| 98 static ChromeURLRequestContextGetter* CreateOriginal( | 98 static ChromeURLRequestContextGetter* CreateOriginal( |
| 99 Profile* profile, | 99 Profile* profile, |
| 100 const ProfileIOData* profile_io_data, | 100 const ProfileIOData* profile_io_data, |
| 101 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 101 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 102 blob_protocol_handler, | 102 blob_protocol_handler, |
| 103 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 103 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 104 file_system_protocol_handler, | 104 file_system_protocol_handler, |
| 105 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 105 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 106 developer_protocol_handler, | |
| 107 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
| 108 chrome_protocol_handler, | 106 chrome_protocol_handler, |
| 109 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 107 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 110 chrome_devtools_protocol_handler); | 108 chrome_devtools_protocol_handler); |
| 111 | 109 |
| 112 // Create an instance for an original profile for media. This is expected to | 110 // Create an instance for an original profile for media. This is expected to |
| 113 // get called on UI thread. This method takes a profile and reuses the | 111 // get called on UI thread. This method takes a profile and reuses the |
| 114 // 'original' net::URLRequestContext for common files. | 112 // 'original' net::URLRequestContext for common files. |
| 115 static ChromeURLRequestContextGetter* CreateOriginalForMedia( | 113 static ChromeURLRequestContextGetter* CreateOriginalForMedia( |
| 116 Profile* profile, const ProfileIOData* profile_io_data); | 114 Profile* profile, const ProfileIOData* profile_io_data); |
| 117 | 115 |
| 118 // Create an instance for an original profile for extensions. This is expected | 116 // Create an instance for an original profile for extensions. This is expected |
| 119 // to get called on UI thread. | 117 // to get called on UI thread. |
| 120 static ChromeURLRequestContextGetter* CreateOriginalForExtensions( | 118 static ChromeURLRequestContextGetter* CreateOriginalForExtensions( |
| 121 Profile* profile, const ProfileIOData* profile_io_data); | 119 Profile* profile, const ProfileIOData* profile_io_data); |
| 122 | 120 |
| 123 // Create an instance for an original profile for an app with isolated | 121 // Create an instance for an original profile for an app with isolated |
| 124 // storage. This is expected to get called on UI thread. | 122 // storage. This is expected to get called on UI thread. |
| 125 static ChromeURLRequestContextGetter* CreateOriginalForIsolatedApp( | 123 static ChromeURLRequestContextGetter* CreateOriginalForIsolatedApp( |
| 126 Profile* profile, | 124 Profile* profile, |
| 127 const ProfileIOData* profile_io_data, | 125 const ProfileIOData* profile_io_data, |
| 128 const StoragePartitionDescriptor& partition_descriptor, | 126 const StoragePartitionDescriptor& partition_descriptor, |
| 129 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> | 127 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> |
| 130 protocol_handler_interceptor, | 128 protocol_handler_interceptor, |
| 131 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 129 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 132 blob_protocol_handler, | 130 blob_protocol_handler, |
| 133 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 131 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 134 file_system_protocol_handler, | 132 file_system_protocol_handler, |
| 135 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 133 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 136 developer_protocol_handler, | |
| 137 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
| 138 chrome_protocol_handler, | 134 chrome_protocol_handler, |
| 139 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 135 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 140 chrome_devtools_protocol_handler); | 136 chrome_devtools_protocol_handler); |
| 141 | 137 |
| 142 // Create an instance for an original profile for media with isolated | 138 // Create an instance for an original profile for media with isolated |
| 143 // storage. This is expected to get called on UI thread. | 139 // storage. This is expected to get called on UI thread. |
| 144 static ChromeURLRequestContextGetter* CreateOriginalForIsolatedMedia( | 140 static ChromeURLRequestContextGetter* CreateOriginalForIsolatedMedia( |
| 145 Profile* profile, | 141 Profile* profile, |
| 146 ChromeURLRequestContextGetter* app_context, | 142 ChromeURLRequestContextGetter* app_context, |
| 147 const ProfileIOData* profile_io_data, | 143 const ProfileIOData* profile_io_data, |
| 148 const StoragePartitionDescriptor& partition_descriptor); | 144 const StoragePartitionDescriptor& partition_descriptor); |
| 149 | 145 |
| 150 // Create an instance for use with an OTR profile. This is expected to get | 146 // Create an instance for use with an OTR profile. This is expected to get |
| 151 // called on the UI thread. | 147 // called on the UI thread. |
| 152 static ChromeURLRequestContextGetter* CreateOffTheRecord( | 148 static ChromeURLRequestContextGetter* CreateOffTheRecord( |
| 153 Profile* profile, | 149 Profile* profile, |
| 154 const ProfileIOData* profile_io_data, | 150 const ProfileIOData* profile_io_data, |
| 155 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 151 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 156 blob_protocol_handler, | 152 blob_protocol_handler, |
| 157 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 153 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 158 file_system_protocol_handler, | 154 file_system_protocol_handler, |
| 159 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 155 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 160 developer_protocol_handler, | |
| 161 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
| 162 chrome_protocol_handler, | 156 chrome_protocol_handler, |
| 163 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 157 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 164 chrome_devtools_protocol_handler); | 158 chrome_devtools_protocol_handler); |
| 165 | 159 |
| 166 // Create an instance for an OTR profile for extensions. This is expected | 160 // Create an instance for an OTR profile for extensions. This is expected |
| 167 // to get called on UI thread. | 161 // to get called on UI thread. |
| 168 static ChromeURLRequestContextGetter* CreateOffTheRecordForExtensions( | 162 static ChromeURLRequestContextGetter* CreateOffTheRecordForExtensions( |
| 169 Profile* profile, const ProfileIOData* profile_io_data); | 163 Profile* profile, const ProfileIOData* profile_io_data); |
| 170 | 164 |
| 171 // Create an instance for an OTR profile for an app with isolated storage. | 165 // Create an instance for an OTR profile for an app with isolated storage. |
| 172 // This is expected to get called on UI thread. | 166 // This is expected to get called on UI thread. |
| 173 static ChromeURLRequestContextGetter* CreateOffTheRecordForIsolatedApp( | 167 static ChromeURLRequestContextGetter* CreateOffTheRecordForIsolatedApp( |
| 174 Profile* profile, | 168 Profile* profile, |
| 175 const ProfileIOData* profile_io_data, | 169 const ProfileIOData* profile_io_data, |
| 176 const StoragePartitionDescriptor& partition_descriptor, | 170 const StoragePartitionDescriptor& partition_descriptor, |
| 177 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> | 171 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> |
| 178 protocol_handler_interceptor, | 172 protocol_handler_interceptor, |
| 179 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 173 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 180 blob_protocol_handler, | 174 blob_protocol_handler, |
| 181 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 175 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 182 file_system_protocol_handler, | 176 file_system_protocol_handler, |
| 183 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 177 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 184 developer_protocol_handler, | |
| 185 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
| 186 chrome_protocol_handler, | 178 chrome_protocol_handler, |
| 187 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 179 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 188 chrome_devtools_protocol_handler); | 180 chrome_devtools_protocol_handler); |
| 189 | 181 |
| 190 private: | 182 private: |
| 191 virtual ~ChromeURLRequestContextGetter(); | 183 virtual ~ChromeURLRequestContextGetter(); |
| 192 | 184 |
| 193 // Deferred logic for creating a ChromeURLRequestContext. | 185 // Deferred logic for creating a ChromeURLRequestContext. |
| 194 // Access only from the IO thread. | 186 // Access only from the IO thread. |
| 195 scoped_ptr<ChromeURLRequestContextFactory> factory_; | 187 scoped_ptr<ChromeURLRequestContextFactory> factory_; |
| 196 | 188 |
| 197 // NULL if not yet initialized. Otherwise, it is the ChromeURLRequestContext | 189 // NULL if not yet initialized. Otherwise, it is the ChromeURLRequestContext |
| 198 // instance that was lazily created by GetURLRequestContext(). | 190 // instance that was lazily created by GetURLRequestContext(). |
| 199 // Access only from the IO thread. | 191 // Access only from the IO thread. |
| 200 base::WeakPtr<ChromeURLRequestContext> url_request_context_; | 192 base::WeakPtr<ChromeURLRequestContext> url_request_context_; |
| 201 | 193 |
| 202 DISALLOW_COPY_AND_ASSIGN(ChromeURLRequestContextGetter); | 194 DISALLOW_COPY_AND_ASSIGN(ChromeURLRequestContextGetter); |
| 203 }; | 195 }; |
| 204 | 196 |
| 205 #endif // CHROME_BROWSER_NET_CHROME_URL_REQUEST_CONTEXT_H_ | 197 #endif // CHROME_BROWSER_NET_CHROME_URL_REQUEST_CONTEXT_H_ |
| OLD | NEW |