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 "chrome/browser/custom_handlers/protocol_handler_registry.h" |
11 #include "net/url_request/url_request_context.h" | 12 #include "net/url_request/url_request_context.h" |
12 #include "net/url_request/url_request_context_getter.h" | 13 #include "net/url_request/url_request_context_getter.h" |
13 #include "net/url_request/url_request_job_factory.h" | 14 #include "net/url_request/url_request_job_factory.h" |
14 | 15 |
15 class ChromeURLDataManagerBackend; | 16 class ChromeURLDataManagerBackend; |
16 class ChromeURLRequestContextFactory; | 17 class ChromeURLRequestContextFactory; |
17 class IOThread; | 18 class IOThread; |
18 class Profile; | 19 class Profile; |
19 class ProfileIOData; | 20 class ProfileIOData; |
20 struct StoragePartitionDescriptor; | 21 struct StoragePartitionDescriptor; |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 // to get called on UI thread. | 126 // to get called on UI thread. |
126 static ChromeURLRequestContextGetter* CreateOriginalForExtensions( | 127 static ChromeURLRequestContextGetter* CreateOriginalForExtensions( |
127 Profile* profile, const ProfileIOData* profile_io_data); | 128 Profile* profile, const ProfileIOData* profile_io_data); |
128 | 129 |
129 // Create an instance for an original profile for an app with isolated | 130 // Create an instance for an original profile for an app with isolated |
130 // storage. This is expected to get called on UI thread. | 131 // storage. This is expected to get called on UI thread. |
131 static ChromeURLRequestContextGetter* CreateOriginalForIsolatedApp( | 132 static ChromeURLRequestContextGetter* CreateOriginalForIsolatedApp( |
132 Profile* profile, | 133 Profile* profile, |
133 const ProfileIOData* profile_io_data, | 134 const ProfileIOData* profile_io_data, |
134 const StoragePartitionDescriptor& partition_descriptor, | 135 const StoragePartitionDescriptor& partition_descriptor, |
135 scoped_ptr<net::URLRequestJobFactory::Interceptor> | 136 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> |
136 protocol_handler_interceptor); | 137 protocol_handler_interceptor); |
137 | 138 |
138 // Create an instance for an original profile for media with isolated | 139 // Create an instance for an original profile for media with isolated |
139 // storage. This is expected to get called on UI thread. | 140 // storage. This is expected to get called on UI thread. |
140 static ChromeURLRequestContextGetter* CreateOriginalForIsolatedMedia( | 141 static ChromeURLRequestContextGetter* CreateOriginalForIsolatedMedia( |
141 Profile* profile, | 142 Profile* profile, |
142 ChromeURLRequestContextGetter* app_context, | 143 ChromeURLRequestContextGetter* app_context, |
143 const ProfileIOData* profile_io_data, | 144 const ProfileIOData* profile_io_data, |
144 const StoragePartitionDescriptor& partition_descriptor); | 145 const StoragePartitionDescriptor& partition_descriptor); |
145 | 146 |
146 // Create an instance for use with an OTR profile. This is expected to get | 147 // Create an instance for use with an OTR profile. This is expected to get |
147 // called on the UI thread. | 148 // called on the UI thread. |
148 static ChromeURLRequestContextGetter* CreateOffTheRecord( | 149 static ChromeURLRequestContextGetter* CreateOffTheRecord( |
149 Profile* profile, const ProfileIOData* profile_io_data); | 150 Profile* profile, const ProfileIOData* profile_io_data); |
150 | 151 |
151 // Create an instance for an OTR profile for extensions. This is expected | 152 // Create an instance for an OTR profile for extensions. This is expected |
152 // to get called on UI thread. | 153 // to get called on UI thread. |
153 static ChromeURLRequestContextGetter* CreateOffTheRecordForExtensions( | 154 static ChromeURLRequestContextGetter* CreateOffTheRecordForExtensions( |
154 Profile* profile, const ProfileIOData* profile_io_data); | 155 Profile* profile, const ProfileIOData* profile_io_data); |
155 | 156 |
156 // Create an instance for an OTR profile for an app with isolated storage. | 157 // Create an instance for an OTR profile for an app with isolated storage. |
157 // This is expected to get called on UI thread. | 158 // This is expected to get called on UI thread. |
158 static ChromeURLRequestContextGetter* CreateOffTheRecordForIsolatedApp( | 159 static ChromeURLRequestContextGetter* CreateOffTheRecordForIsolatedApp( |
159 Profile* profile, | 160 Profile* profile, |
160 const ProfileIOData* profile_io_data, | 161 const ProfileIOData* profile_io_data, |
161 const StoragePartitionDescriptor& partition_descriptor, | 162 const StoragePartitionDescriptor& partition_descriptor, |
162 scoped_ptr<net::URLRequestJobFactory::Interceptor> | 163 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> |
163 protocol_handler_interceptor); | 164 protocol_handler_interceptor); |
164 | 165 |
165 private: | 166 private: |
166 virtual ~ChromeURLRequestContextGetter(); | 167 virtual ~ChromeURLRequestContextGetter(); |
167 | 168 |
168 // Deferred logic for creating a ChromeURLRequestContext. | 169 // Deferred logic for creating a ChromeURLRequestContext. |
169 // Access only from the IO thread. | 170 // Access only from the IO thread. |
170 scoped_ptr<ChromeURLRequestContextFactory> factory_; | 171 scoped_ptr<ChromeURLRequestContextFactory> factory_; |
171 | 172 |
172 // NULL if not yet initialized. Otherwise, it is the ChromeURLRequestContext | 173 // NULL if not yet initialized. Otherwise, it is the ChromeURLRequestContext |
173 // instance that was lazily created by GetURLRequestContext(). | 174 // instance that was lazily created by GetURLRequestContext(). |
174 // Access only from the IO thread. | 175 // Access only from the IO thread. |
175 base::WeakPtr<ChromeURLRequestContext> url_request_context_; | 176 base::WeakPtr<ChromeURLRequestContext> url_request_context_; |
176 | 177 |
177 DISALLOW_COPY_AND_ASSIGN(ChromeURLRequestContextGetter); | 178 DISALLOW_COPY_AND_ASSIGN(ChromeURLRequestContextGetter); |
178 }; | 179 }; |
179 | 180 |
180 #endif // CHROME_BROWSER_NET_CHROME_URL_REQUEST_CONTEXT_H_ | 181 #endif // CHROME_BROWSER_NET_CHROME_URL_REQUEST_CONTEXT_H_ |
OLD | NEW |