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