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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 Profile* profile, | 93 Profile* profile, |
94 const ProfileIOData* profile_io_data, | 94 const ProfileIOData* profile_io_data, |
95 content::ProtocolHandlerMap* protocol_handlers); | 95 content::ProtocolHandlerMap* protocol_handlers); |
96 | 96 |
97 // 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 |
98 // 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 |
99 // 'original' net::URLRequestContext for common files. | 99 // 'original' net::URLRequestContext for common files. |
100 static ChromeURLRequestContextGetter* CreateOriginalForMedia( | 100 static ChromeURLRequestContextGetter* CreateOriginalForMedia( |
101 Profile* profile, const ProfileIOData* profile_io_data); | 101 Profile* profile, const ProfileIOData* profile_io_data); |
102 | 102 |
103 // Create an instance for an original profile for extensions. This is expected | |
104 // to get called on UI thread. | |
105 static ChromeURLRequestContextGetter* CreateOriginalForExtensions( | |
106 Profile* profile, const ProfileIOData* profile_io_data); | |
107 | |
108 // Create an instance for an original profile for an app with isolated | 103 // Create an instance for an original profile for an app with isolated |
109 // storage. This is expected to get called on UI thread. | 104 // storage. This is expected to get called on UI thread. |
110 static ChromeURLRequestContextGetter* CreateOriginalForIsolatedApp( | 105 static ChromeURLRequestContextGetter* CreateOriginalForIsolatedApp( |
111 Profile* profile, | 106 Profile* profile, |
112 const ProfileIOData* profile_io_data, | 107 const ProfileIOData* profile_io_data, |
113 const StoragePartitionDescriptor& partition_descriptor, | 108 const StoragePartitionDescriptor& partition_descriptor, |
114 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> | 109 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> |
115 protocol_handler_interceptor, | 110 protocol_handler_interceptor, |
116 content::ProtocolHandlerMap* protocol_handlers); | 111 content::ProtocolHandlerMap* protocol_handlers); |
117 | 112 |
118 // Create an instance for an original profile for media with isolated | 113 // Create an instance for an original profile for media with isolated |
119 // storage. This is expected to get called on UI thread. | 114 // storage. This is expected to get called on UI thread. |
120 static ChromeURLRequestContextGetter* CreateOriginalForIsolatedMedia( | 115 static ChromeURLRequestContextGetter* CreateOriginalForIsolatedMedia( |
121 Profile* profile, | 116 Profile* profile, |
122 ChromeURLRequestContextGetter* app_context, | 117 ChromeURLRequestContextGetter* app_context, |
123 const ProfileIOData* profile_io_data, | 118 const ProfileIOData* profile_io_data, |
124 const StoragePartitionDescriptor& partition_descriptor); | 119 const StoragePartitionDescriptor& partition_descriptor); |
125 | 120 |
126 // Create an instance for use with an OTR profile. This is expected to get | 121 // Create an instance for use with an OTR profile. This is expected to get |
127 // called on the UI thread. | 122 // called on the UI thread. |
128 static ChromeURLRequestContextGetter* CreateOffTheRecord( | 123 static ChromeURLRequestContextGetter* CreateOffTheRecord( |
129 Profile* profile, | 124 Profile* profile, |
130 const ProfileIOData* profile_io_data, | 125 const ProfileIOData* profile_io_data, |
131 content::ProtocolHandlerMap* protocol_handlers); | 126 content::ProtocolHandlerMap* protocol_handlers); |
132 | 127 |
133 // Create an instance for an OTR profile for extensions. This is expected | |
134 // to get called on UI thread. | |
135 static ChromeURLRequestContextGetter* CreateOffTheRecordForExtensions( | |
136 Profile* profile, const ProfileIOData* profile_io_data); | |
137 | |
138 // Create an instance for an OTR profile for an app with isolated storage. | 128 // Create an instance for an OTR profile for an app with isolated storage. |
139 // This is expected to get called on UI thread. | 129 // This is expected to get called on UI thread. |
140 static ChromeURLRequestContextGetter* CreateOffTheRecordForIsolatedApp( | 130 static ChromeURLRequestContextGetter* CreateOffTheRecordForIsolatedApp( |
141 Profile* profile, | 131 Profile* profile, |
142 const ProfileIOData* profile_io_data, | 132 const ProfileIOData* profile_io_data, |
143 const StoragePartitionDescriptor& partition_descriptor, | 133 const StoragePartitionDescriptor& partition_descriptor, |
144 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> | 134 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> |
145 protocol_handler_interceptor, | 135 protocol_handler_interceptor, |
146 content::ProtocolHandlerMap* protocol_handlers); | 136 content::ProtocolHandlerMap* protocol_handlers); |
147 | 137 |
148 private: | 138 private: |
149 virtual ~ChromeURLRequestContextGetter(); | 139 virtual ~ChromeURLRequestContextGetter(); |
150 | 140 |
151 // Deferred logic for creating a ChromeURLRequestContext. | 141 // Deferred logic for creating a ChromeURLRequestContext. |
152 // Access only from the IO thread. | 142 // Access only from the IO thread. |
153 scoped_ptr<ChromeURLRequestContextFactory> factory_; | 143 scoped_ptr<ChromeURLRequestContextFactory> factory_; |
154 | 144 |
155 // NULL if not yet initialized. Otherwise, it is the ChromeURLRequestContext | 145 // NULL if not yet initialized. Otherwise, it is the ChromeURLRequestContext |
156 // instance that was lazily created by GetURLRequestContext(). | 146 // instance that was lazily created by GetURLRequestContext(). |
157 // Access only from the IO thread. | 147 // Access only from the IO thread. |
158 base::WeakPtr<ChromeURLRequestContext> url_request_context_; | 148 base::WeakPtr<ChromeURLRequestContext> url_request_context_; |
159 | 149 |
160 DISALLOW_COPY_AND_ASSIGN(ChromeURLRequestContextGetter); | 150 DISALLOW_COPY_AND_ASSIGN(ChromeURLRequestContextGetter); |
161 }; | 151 }; |
162 | 152 |
163 #endif // CHROME_BROWSER_NET_CHROME_URL_REQUEST_CONTEXT_H_ | 153 #endif // CHROME_BROWSER_NET_CHROME_URL_REQUEST_CONTEXT_H_ |
OLD | NEW |