| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 GetMediaRequestContextGetter() const; | 64 GetMediaRequestContextGetter() const; |
| 65 scoped_refptr<ChromeURLRequestContextGetter> | 65 scoped_refptr<ChromeURLRequestContextGetter> |
| 66 GetExtensionsRequestContextGetter() const; | 66 GetExtensionsRequestContextGetter() const; |
| 67 scoped_refptr<ChromeURLRequestContextGetter> | 67 scoped_refptr<ChromeURLRequestContextGetter> |
| 68 GetIsolatedAppRequestContextGetter( | 68 GetIsolatedAppRequestContextGetter( |
| 69 const std::string& app_id) const; | 69 const std::string& app_id) const; |
| 70 scoped_refptr<ChromeURLRequestContextGetter> | 70 scoped_refptr<ChromeURLRequestContextGetter> |
| 71 GetIsolatedMediaRequestContextGetter( | 71 GetIsolatedMediaRequestContextGetter( |
| 72 const std::string& app_id) const; | 72 const std::string& app_id) const; |
| 73 | 73 |
| 74 void ClearNetworkingHistorySince(base::Time time); | 74 void ClearNetworkingHistorySince(base::Time time, |
| 75 const base::Closure& completion); |
| 75 | 76 |
| 76 private: | 77 private: |
| 78 friend class TestingProfile; |
| 79 |
| 77 typedef base::hash_map<std::string, | 80 typedef base::hash_map<std::string, |
| 78 scoped_refptr<ChromeURLRequestContextGetter> > | 81 scoped_refptr<ChromeURLRequestContextGetter> > |
| 79 ChromeURLRequestContextGetterMap; | 82 ChromeURLRequestContextGetterMap; |
| 80 | 83 |
| 84 // Sets up a skeleton instance to be used by TestingProfile in unit tests. |
| 85 // Gets the object into a virtually initialized state, but skips most of the |
| 86 // usual initialization steps, and only creates what is needed for testing. |
| 87 void InitForTesting() const; |
| 88 |
| 81 // Lazily initialize ProfileParams. We do this on the calls to | 89 // Lazily initialize ProfileParams. We do this on the calls to |
| 82 // Get*RequestContextGetter(), so we only initialize ProfileParams right | 90 // Get*RequestContextGetter(), so we only initialize ProfileParams right |
| 83 // before posting a task to the IO thread to start using them. This prevents | 91 // before posting a task to the IO thread to start using them. This prevents |
| 84 // objects that are supposed to be deleted on the IO thread, but are created | 92 // objects that are supposed to be deleted on the IO thread, but are created |
| 85 // on the UI thread from being unnecessarily initialized. | 93 // on the UI thread from being unnecessarily initialized. |
| 86 void LazyInitialize() const; | 94 void LazyInitialize() const; |
| 87 | 95 |
| 88 // Ordering is important here. Do not reorder unless you know what you're | 96 // Ordering is important here. Do not reorder unless you know what you're |
| 89 // doing. We need to release |io_data_| *before* the getters, because we | 97 // doing. We need to release |io_data_| *before* the getters, because we |
| 90 // want to make sure that the last reference for |io_data_| is on the IO | 98 // want to make sure that the last reference for |io_data_| is on the IO |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 IOThread::Globals* io_thread_globals) const OVERRIDE; | 169 IOThread::Globals* io_thread_globals) const OVERRIDE; |
| 162 | 170 |
| 163 void SetUpJobFactory(net::URLRequestJobFactory* job_factory, | 171 void SetUpJobFactory(net::URLRequestJobFactory* job_factory, |
| 164 scoped_ptr<net::URLRequestJobFactory::Interceptor> | 172 scoped_ptr<net::URLRequestJobFactory::Interceptor> |
| 165 protocol_handler_interceptor, | 173 protocol_handler_interceptor, |
| 166 net::NetworkDelegate* network_delegate, | 174 net::NetworkDelegate* network_delegate, |
| 167 net::FtpTransactionFactory* ftp_transaction_factory, | 175 net::FtpTransactionFactory* ftp_transaction_factory, |
| 168 net::FtpAuthCache* ftp_auth_cache) const; | 176 net::FtpAuthCache* ftp_auth_cache) const; |
| 169 | 177 |
| 170 // Clears the networking history since |time|. | 178 // Clears the networking history since |time|. |
| 171 void ClearNetworkingHistorySinceOnIOThread(base::Time time); | 179 void ClearNetworkingHistorySinceOnIOThread(base::Time time, |
| 180 const base::Closure& completion); |
| 172 | 181 |
| 173 // Lazy initialization params. | 182 // Lazy initialization params. |
| 174 mutable scoped_ptr<LazyParams> lazy_params_; | 183 mutable scoped_ptr<LazyParams> lazy_params_; |
| 175 | 184 |
| 176 mutable scoped_ptr<net::HttpTransactionFactory> main_http_factory_; | 185 mutable scoped_ptr<net::HttpTransactionFactory> main_http_factory_; |
| 177 mutable scoped_ptr<net::FtpTransactionFactory> ftp_factory_; | 186 mutable scoped_ptr<net::FtpTransactionFactory> ftp_factory_; |
| 178 | 187 |
| 179 mutable scoped_ptr<chrome_browser_net::Predictor> predictor_; | 188 mutable scoped_ptr<chrome_browser_net::Predictor> predictor_; |
| 180 | 189 |
| 181 mutable scoped_ptr<ChromeURLRequestContext> media_request_context_; | 190 mutable scoped_ptr<ChromeURLRequestContext> media_request_context_; |
| 182 | 191 |
| 183 mutable scoped_ptr<net::URLRequestJobFactory> main_job_factory_; | 192 mutable scoped_ptr<net::URLRequestJobFactory> main_job_factory_; |
| 184 mutable scoped_ptr<net::URLRequestJobFactory> extensions_job_factory_; | 193 mutable scoped_ptr<net::URLRequestJobFactory> extensions_job_factory_; |
| 185 | 194 |
| 186 // Parameters needed for isolated apps. | 195 // Parameters needed for isolated apps. |
| 187 FilePath profile_path_; | 196 FilePath profile_path_; |
| 188 int app_cache_max_size_; | 197 int app_cache_max_size_; |
| 189 int app_media_cache_max_size_; | 198 int app_media_cache_max_size_; |
| 190 | 199 |
| 191 DISALLOW_COPY_AND_ASSIGN(ProfileImplIOData); | 200 DISALLOW_COPY_AND_ASSIGN(ProfileImplIOData); |
| 192 }; | 201 }; |
| 193 | 202 |
| 194 #endif // CHROME_BROWSER_PROFILES_PROFILE_IMPL_IO_DATA_H_ | 203 #endif // CHROME_BROWSER_PROFILES_PROFILE_IMPL_IO_DATA_H_ |
| OLD | NEW |