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_PROFILES_PROFILE_IMPL_IO_DATA_H_ | 5 #ifndef CHROME_BROWSER_PROFILES_PROFILE_IMPL_IO_DATA_H_ |
6 #define CHROME_BROWSER_PROFILES_PROFILE_IMPL_IO_DATA_H_ | 6 #define CHROME_BROWSER_PROFILES_PROFILE_IMPL_IO_DATA_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/hash_tables.h" | 10 #include "base/hash_tables.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 class SpecialStoragePolicy; | 25 class SpecialStoragePolicy; |
26 } // namespace quota | 26 } // namespace quota |
27 | 27 |
28 class ProfileImplIOData : public ProfileIOData { | 28 class ProfileImplIOData : public ProfileIOData { |
29 public: | 29 public: |
30 class Handle { | 30 class Handle { |
31 public: | 31 public: |
32 explicit Handle(Profile* profile); | 32 explicit Handle(Profile* profile); |
33 ~Handle(); | 33 ~Handle(); |
34 | 34 |
35 bool HasMainRequestContext() const { | 35 // Init() must be called before ~Handle(). It records most of the |
36 return main_request_context_getter_ != NULL; | |
37 } | |
38 | |
39 // Init() must be called before ~Handle(). It records all the necessary | |
40 // parameters needed to construct a ChromeURLRequestContextGetter. | 36 // parameters needed to construct a ChromeURLRequestContextGetter. |
41 void Init(const FilePath& cookie_path, | 37 void Init(const FilePath& cookie_path, |
42 const FilePath& server_bound_cert_path, | 38 const FilePath& server_bound_cert_path, |
43 const FilePath& cache_path, | 39 const FilePath& cache_path, |
44 int cache_max_size, | 40 int cache_max_size, |
45 const FilePath& media_cache_path, | 41 const FilePath& media_cache_path, |
46 int media_cache_max_size, | 42 int media_cache_max_size, |
47 const FilePath& extensions_cookie_path, | 43 const FilePath& extensions_cookie_path, |
48 const FilePath& profile_path, | 44 const FilePath& profile_path, |
49 const FilePath& infinite_cache_path, | 45 const FilePath& infinite_cache_path, |
50 chrome_browser_net::Predictor* predictor, | 46 chrome_browser_net::Predictor* predictor, |
51 PrefService* local_state, | |
52 IOThread* io_thread, | |
53 bool restore_old_session_cookies, | 47 bool restore_old_session_cookies, |
54 quota::SpecialStoragePolicy* special_storage_policy); | 48 quota::SpecialStoragePolicy* special_storage_policy); |
55 | 49 |
| 50 // These Create*ContextGetter() functions are only exposed because the |
| 51 // circular relationship between Profile, ProfileIOData::Handle, and the |
| 52 // ChromeURLRequestContextGetter factories requires Profile be able to call |
| 53 // these functions. |
| 54 scoped_refptr<ChromeURLRequestContextGetter> |
| 55 CreateMainRequestContextGetter( |
| 56 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 57 blob_protocol_handler, |
| 58 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 59 file_system_protocol_handler, |
| 60 scoped_ptr<net::URLRequestJobFactory::Interceptor> |
| 61 developer_protocol_handler, |
| 62 PrefService* local_state, |
| 63 IOThread* io_thread) const; |
| 64 scoped_refptr<ChromeURLRequestContextGetter> |
| 65 CreateIsolatedAppRequestContextGetter( |
| 66 const FilePath& partition_path, |
| 67 bool in_memory, |
| 68 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 69 blob_protocol_handler, |
| 70 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 71 file_system_protocol_handler, |
| 72 scoped_ptr<net::URLRequestJobFactory::Interceptor> |
| 73 developer_protocol_handler) const; |
| 74 |
56 base::Callback<ChromeURLDataManagerBackend*(void)> | 75 base::Callback<ChromeURLDataManagerBackend*(void)> |
57 GetChromeURLDataManagerBackendGetter() const; | 76 GetChromeURLDataManagerBackendGetter() const; |
58 content::ResourceContext* GetResourceContext() const; | 77 content::ResourceContext* GetResourceContext() const; |
59 // GetResourceContextNoInit() does not call LazyInitialize() so it can be | 78 // GetResourceContextNoInit() does not call LazyInitialize() so it can be |
60 // safely be used during initialization. | 79 // safely be used during initialization. |
61 content::ResourceContext* GetResourceContextNoInit() const; | 80 content::ResourceContext* GetResourceContextNoInit() const; |
62 scoped_refptr<ChromeURLRequestContextGetter> | 81 scoped_refptr<ChromeURLRequestContextGetter> |
63 GetMainRequestContextGetter() const; | 82 GetMainRequestContextGetter() const; |
64 scoped_refptr<ChromeURLRequestContextGetter> | 83 scoped_refptr<ChromeURLRequestContextGetter> |
65 GetMediaRequestContextGetter() const; | 84 GetMediaRequestContextGetter() const; |
66 scoped_refptr<ChromeURLRequestContextGetter> | 85 scoped_refptr<ChromeURLRequestContextGetter> |
67 GetExtensionsRequestContextGetter() const; | 86 GetExtensionsRequestContextGetter() const; |
68 scoped_refptr<ChromeURLRequestContextGetter> | 87 scoped_refptr<ChromeURLRequestContextGetter> |
69 GetIsolatedAppRequestContextGetter( | |
70 const FilePath& partition_path, | |
71 bool in_memory) const; | |
72 scoped_refptr<ChromeURLRequestContextGetter> | |
73 GetIsolatedMediaRequestContextGetter( | 88 GetIsolatedMediaRequestContextGetter( |
74 const FilePath& partition_path, | 89 const FilePath& partition_path, |
75 bool in_memory) const; | 90 bool in_memory) const; |
76 | 91 |
77 // Deletes all network related data since |time|. It deletes transport | 92 // Deletes all network related data since |time|. It deletes transport |
78 // security state since |time| and also deletes HttpServerProperties data. | 93 // security state since |time| and also deletes HttpServerProperties data. |
79 // Works asynchronously, however if the |completion| callback is non-null, | 94 // Works asynchronously, however if the |completion| callback is non-null, |
80 // it will be posted on the UI thread once the removal process completes. | 95 // it will be posted on the UI thread once the removal process completes. |
81 void ClearNetworkingHistorySince(base::Time time, | 96 void ClearNetworkingHistorySince(base::Time time, |
82 const base::Closure& completion); | 97 const base::Closure& completion); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 bool restore_old_session_cookies; | 152 bool restore_old_session_cookies; |
138 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy; | 153 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy; |
139 }; | 154 }; |
140 | 155 |
141 typedef base::hash_map<std::string, net::HttpTransactionFactory* > | 156 typedef base::hash_map<std::string, net::HttpTransactionFactory* > |
142 HttpTransactionFactoryMap; | 157 HttpTransactionFactoryMap; |
143 | 158 |
144 ProfileImplIOData(); | 159 ProfileImplIOData(); |
145 virtual ~ProfileImplIOData(); | 160 virtual ~ProfileImplIOData(); |
146 | 161 |
147 virtual void LazyInitializeInternal( | 162 virtual void InitializeInternal( |
148 ProfileParams* profile_params) const OVERRIDE; | 163 ProfileParams* profile_params, |
| 164 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 165 blob_protocol_handler, |
| 166 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 167 file_system_protocol_handler, |
| 168 scoped_ptr<net::URLRequestJobFactory::Interceptor> |
| 169 developer_protocol_handler) const OVERRIDE; |
149 virtual void InitializeExtensionsRequestContext( | 170 virtual void InitializeExtensionsRequestContext( |
150 ProfileParams* profile_params) const OVERRIDE; | 171 ProfileParams* profile_params) const OVERRIDE; |
151 virtual ChromeURLRequestContext* InitializeAppRequestContext( | 172 virtual ChromeURLRequestContext* InitializeAppRequestContext( |
152 ChromeURLRequestContext* main_context, | 173 ChromeURLRequestContext* main_context, |
153 const StoragePartitionDescriptor& partition_descriptor, | 174 const StoragePartitionDescriptor& partition_descriptor, |
154 scoped_ptr<net::URLRequestJobFactory::Interceptor> | 175 scoped_ptr<net::URLRequestJobFactory::Interceptor> |
155 protocol_handler_interceptor) const OVERRIDE; | 176 protocol_handler_interceptor, |
| 177 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 178 blob_protocol_handler, |
| 179 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 180 file_system_protocol_handler, |
| 181 scoped_ptr<net::URLRequestJobFactory::Interceptor> |
| 182 developer_protocol_handler) const OVERRIDE; |
156 virtual ChromeURLRequestContext* InitializeMediaRequestContext( | 183 virtual ChromeURLRequestContext* InitializeMediaRequestContext( |
157 ChromeURLRequestContext* original_context, | 184 ChromeURLRequestContext* original_context, |
158 const StoragePartitionDescriptor& partition_descriptor) const OVERRIDE; | 185 const StoragePartitionDescriptor& partition_descriptor) const OVERRIDE; |
159 virtual ChromeURLRequestContext* | 186 virtual ChromeURLRequestContext* |
160 AcquireMediaRequestContext() const OVERRIDE; | 187 AcquireMediaRequestContext() const OVERRIDE; |
161 virtual ChromeURLRequestContext* | 188 virtual ChromeURLRequestContext* |
162 AcquireIsolatedAppRequestContext( | 189 AcquireIsolatedAppRequestContext( |
163 ChromeURLRequestContext* main_context, | 190 ChromeURLRequestContext* main_context, |
164 const StoragePartitionDescriptor& partition_descriptor, | 191 const StoragePartitionDescriptor& partition_descriptor, |
165 scoped_ptr<net::URLRequestJobFactory::Interceptor> | 192 scoped_ptr<net::URLRequestJobFactory::Interceptor> |
166 protocol_handler_interceptor) const OVERRIDE; | 193 protocol_handler_interceptor, |
| 194 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 195 blob_protocol_handler, |
| 196 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 197 file_system_protocol_handler, |
| 198 scoped_ptr<net::URLRequestJobFactory::Interceptor> |
| 199 developer_protocol_handler) const OVERRIDE; |
167 virtual ChromeURLRequestContext* | 200 virtual ChromeURLRequestContext* |
168 AcquireIsolatedMediaRequestContext( | 201 AcquireIsolatedMediaRequestContext( |
169 ChromeURLRequestContext* app_context, | 202 ChromeURLRequestContext* app_context, |
170 const StoragePartitionDescriptor& partition_descriptor) | 203 const StoragePartitionDescriptor& partition_descriptor) |
171 const OVERRIDE; | 204 const OVERRIDE; |
172 virtual chrome_browser_net::LoadTimeStats* GetLoadTimeStats( | 205 virtual chrome_browser_net::LoadTimeStats* GetLoadTimeStats( |
173 IOThread::Globals* io_thread_globals) const OVERRIDE; | 206 IOThread::Globals* io_thread_globals) const OVERRIDE; |
174 | 207 |
175 void SetUpJobFactory(net::URLRequestJobFactoryImpl* job_factory, | 208 void SetUpJobFactory(net::URLRequestJobFactoryImpl* job_factory, |
176 scoped_ptr<net::URLRequestJobFactory::Interceptor> | 209 scoped_ptr<net::URLRequestJobFactory::Interceptor> |
(...skipping 29 matching lines...) Expand all Loading... |
206 | 239 |
207 // Parameters needed for isolated apps. | 240 // Parameters needed for isolated apps. |
208 FilePath profile_path_; | 241 FilePath profile_path_; |
209 int app_cache_max_size_; | 242 int app_cache_max_size_; |
210 int app_media_cache_max_size_; | 243 int app_media_cache_max_size_; |
211 | 244 |
212 DISALLOW_COPY_AND_ASSIGN(ProfileImplIOData); | 245 DISALLOW_COPY_AND_ASSIGN(ProfileImplIOData); |
213 }; | 246 }; |
214 | 247 |
215 #endif // CHROME_BROWSER_PROFILES_PROFILE_IMPL_IO_DATA_H_ | 248 #endif // CHROME_BROWSER_PROFILES_PROFILE_IMPL_IO_DATA_H_ |
OLD | NEW |