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 #include "chrome/browser/profiles/profile_impl_io_data.h" | 5 #include "chrome/browser/profiles/profile_impl_io_data.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 GetIsolatedAppRequestContextGetter(partition_path, in_memory); | 262 GetIsolatedAppRequestContextGetter(partition_path, in_memory); |
263 ChromeURLRequestContextGetter* context = | 263 ChromeURLRequestContextGetter* context = |
264 ChromeURLRequestContextGetter::CreateOriginalForIsolatedMedia( | 264 ChromeURLRequestContextGetter::CreateOriginalForIsolatedMedia( |
265 profile_, app_context, io_data_, descriptor); | 265 profile_, app_context, io_data_, descriptor); |
266 isolated_media_request_context_getter_map_[descriptor] = context; | 266 isolated_media_request_context_getter_map_[descriptor] = context; |
267 | 267 |
268 return context; | 268 return context; |
269 } | 269 } |
270 | 270 |
271 void ProfileImplIOData::Handle::ClearNetworkingHistorySince( | 271 void ProfileImplIOData::Handle::ClearNetworkingHistorySince( |
272 base::Time time) { | 272 base::Time time, |
| 273 const base::Closure& completion) { |
273 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 274 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
274 LazyInitialize(); | 275 LazyInitialize(); |
275 | 276 |
276 BrowserThread::PostTask( | 277 BrowserThread::PostTask( |
277 BrowserThread::IO, FROM_HERE, | 278 BrowserThread::IO, FROM_HERE, |
278 base::Bind( | 279 base::Bind( |
279 &ProfileImplIOData::ClearNetworkingHistorySinceOnIOThread, | 280 &ProfileImplIOData::ClearNetworkingHistorySinceOnIOThread, |
280 base::Unretained(io_data_), | 281 base::Unretained(io_data_), |
281 time)); | 282 time, |
| 283 completion)); |
282 } | 284 } |
283 | 285 |
284 void ProfileImplIOData::Handle::LazyInitialize() const { | 286 void ProfileImplIOData::Handle::LazyInitialize() const { |
285 if (initialized_) | 287 if (initialized_) |
286 return; | 288 return; |
287 | 289 |
288 // Set initialized_ to true at the beginning in case any of the objects | 290 // Set initialized_ to true at the beginning in case any of the objects |
289 // below try to get the ResourceContext pointer. | 291 // below try to get the ResourceContext pointer. |
290 initialized_ = true; | 292 initialized_ = true; |
291 PrefService* pref_service = profile_->GetPrefs(); | 293 PrefService* pref_service = profile_->GetPrefs(); |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 net::FtpAuthCache* ftp_auth_cache) const { | 672 net::FtpAuthCache* ftp_auth_cache) const { |
671 SetUpJobFactoryDefaults(job_factory, protocol_handler_interceptor.Pass(), | 673 SetUpJobFactoryDefaults(job_factory, protocol_handler_interceptor.Pass(), |
672 network_delegate, ftp_transaction_factory, | 674 network_delegate, ftp_transaction_factory, |
673 ftp_auth_cache); | 675 ftp_auth_cache); |
674 | 676 |
675 job_factory->AddInterceptor( | 677 job_factory->AddInterceptor( |
676 new chrome_browser_net::ConnectInterceptor(predictor_.get())); | 678 new chrome_browser_net::ConnectInterceptor(predictor_.get())); |
677 } | 679 } |
678 | 680 |
679 void ProfileImplIOData::ClearNetworkingHistorySinceOnIOThread( | 681 void ProfileImplIOData::ClearNetworkingHistorySinceOnIOThread( |
680 base::Time time) { | 682 base::Time time, |
| 683 const base::Closure& completion) { |
681 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 684 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
682 LazyInitialize(); | 685 LazyInitialize(); |
683 | 686 |
684 DCHECK(transport_security_state()); | 687 DCHECK(transport_security_state()); |
685 transport_security_state()->DeleteSince(time); | 688 transport_security_state()->DeleteSince(time); // Completes synchronously. |
686 DCHECK(http_server_properties_manager()); | 689 DCHECK(http_server_properties_manager()); |
687 http_server_properties_manager()->Clear(); | 690 http_server_properties_manager()->Clear(completion); |
688 } | 691 } |
OLD | NEW |