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