OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/browsing_data_remover.h" | 5 #include "chrome/browser/browsing_data_remover.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "chrome/browser/autofill/personal_data_manager.h" | 11 #include "chrome/browser/autofill/personal_data_manager.h" |
12 #include "chrome/browser/browser_thread.h" | 12 #include "chrome/browser/browser_thread.h" |
13 #include "chrome/browser/download/download_manager.h" | 13 #include "chrome/browser/download/download_manager.h" |
14 #include "chrome/browser/extensions/extensions_service.h" | 14 #include "chrome/browser/extensions/extensions_service.h" |
15 #include "chrome/browser/history/history.h" | 15 #include "chrome/browser/history/history.h" |
16 #include "chrome/browser/in_process_webkit/webkit_context.h" | 16 #include "chrome/browser/in_process_webkit/webkit_context.h" |
| 17 #include "chrome/browser/plugin_data_remover.h" |
17 #include "chrome/browser/profile.h" | 18 #include "chrome/browser/profile.h" |
18 #include "chrome/browser/metrics/user_metrics.h" | 19 #include "chrome/browser/metrics/user_metrics.h" |
19 #include "chrome/browser/net/chrome_url_request_context.h" | 20 #include "chrome/browser/net/chrome_url_request_context.h" |
20 #include "chrome/browser/password_manager/password_store.h" | 21 #include "chrome/browser/password_manager/password_store.h" |
21 #include "chrome/browser/renderer_host/web_cache_manager.h" | 22 #include "chrome/browser/renderer_host/web_cache_manager.h" |
22 #include "chrome/browser/search_engines/template_url_model.h" | 23 #include "chrome/browser/search_engines/template_url_model.h" |
23 #include "chrome/browser/sessions/session_service.h" | 24 #include "chrome/browser/sessions/session_service.h" |
24 #include "chrome/browser/sessions/tab_restore_service.h" | 25 #include "chrome/browser/sessions/tab_restore_service.h" |
25 #include "chrome/browser/webdata/web_data_service.h" | 26 #include "chrome/browser/webdata/web_data_service.h" |
26 #include "chrome/common/net/url_request_context_getter.h" | 27 #include "chrome/common/net/url_request_context_getter.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 this, &BrowsingDataRemover::OnGotAppCacheInfo)), | 81 this, &BrowsingDataRemover::OnGotAppCacheInfo)), |
81 ALLOW_THIS_IN_INITIALIZER_LIST(appcache_deleted_callback_( | 82 ALLOW_THIS_IN_INITIALIZER_LIST(appcache_deleted_callback_( |
82 this, &BrowsingDataRemover::OnAppCacheDeleted)), | 83 this, &BrowsingDataRemover::OnAppCacheDeleted)), |
83 request_context_getter_(profile->GetRequestContext()), | 84 request_context_getter_(profile->GetRequestContext()), |
84 appcaches_to_be_deleted_count_(0), | 85 appcaches_to_be_deleted_count_(0), |
85 next_cache_state_(STATE_NONE), | 86 next_cache_state_(STATE_NONE), |
86 cache_(NULL), | 87 cache_(NULL), |
87 waiting_for_clear_databases_(false), | 88 waiting_for_clear_databases_(false), |
88 waiting_for_clear_history_(false), | 89 waiting_for_clear_history_(false), |
89 waiting_for_clear_cache_(false), | 90 waiting_for_clear_cache_(false), |
90 waiting_for_clear_appcache_(false) { | 91 waiting_for_clear_appcache_(false), |
| 92 waiting_for_clear_lso_data_(false) { |
91 DCHECK(profile); | 93 DCHECK(profile); |
92 } | 94 } |
93 | 95 |
94 BrowsingDataRemover::~BrowsingDataRemover() { | 96 BrowsingDataRemover::~BrowsingDataRemover() { |
95 DCHECK(all_done()); | 97 DCHECK(all_done()); |
96 } | 98 } |
97 | 99 |
98 void BrowsingDataRemover::Remove(int remove_mask) { | 100 void BrowsingDataRemover::Remove(int remove_mask) { |
99 DCHECK(!removing_); | 101 DCHECK(!removing_); |
100 removing_ = true; | 102 removing_ = true; |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 profile_); | 247 profile_); |
246 | 248 |
247 main_context_getter_ = profile_->GetRequestContext(); | 249 main_context_getter_ = profile_->GetRequestContext(); |
248 media_context_getter_ = profile_->GetRequestContextForMedia(); | 250 media_context_getter_ = profile_->GetRequestContextForMedia(); |
249 | 251 |
250 BrowserThread::PostTask( | 252 BrowserThread::PostTask( |
251 BrowserThread::IO, FROM_HERE, | 253 BrowserThread::IO, FROM_HERE, |
252 NewRunnableMethod(this, &BrowsingDataRemover::ClearCacheOnIOThread)); | 254 NewRunnableMethod(this, &BrowsingDataRemover::ClearCacheOnIOThread)); |
253 } | 255 } |
254 | 256 |
| 257 if (remove_mask & REMOVE_LSO_DATA) { |
| 258 UserMetrics::RecordAction(UserMetricsAction("ClearBrowsingData_LSOData")); |
| 259 |
| 260 waiting_for_clear_lso_data_ = true; |
| 261 if (!plugin_data_remover_.get()) |
| 262 plugin_data_remover_.reset(new PluginDataRemover()); |
| 263 plugin_data_remover_->StartRemoving( |
| 264 delete_begin_, |
| 265 NewRunnableMethod(this, &BrowsingDataRemover::OnClearedPluginData)); |
| 266 } |
| 267 |
255 NotifyAndDeleteIfDone(); | 268 NotifyAndDeleteIfDone(); |
256 } | 269 } |
257 | 270 |
258 void BrowsingDataRemover::AddObserver(Observer* observer) { | 271 void BrowsingDataRemover::AddObserver(Observer* observer) { |
259 observer_list_.AddObserver(observer); | 272 observer_list_.AddObserver(observer); |
260 } | 273 } |
261 | 274 |
262 void BrowsingDataRemover::RemoveObserver(Observer* observer) { | 275 void BrowsingDataRemover::RemoveObserver(Observer* observer) { |
263 observer_list_.RemoveObserver(observer); | 276 observer_list_.RemoveObserver(observer); |
264 } | 277 } |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 } | 502 } |
490 | 503 |
491 ChromeAppCacheService* BrowsingDataRemover::GetAppCacheService() { | 504 ChromeAppCacheService* BrowsingDataRemover::GetAppCacheService() { |
492 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 505 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
493 ChromeURLRequestContext* request_context = | 506 ChromeURLRequestContext* request_context = |
494 reinterpret_cast<ChromeURLRequestContext*>( | 507 reinterpret_cast<ChromeURLRequestContext*>( |
495 request_context_getter_->GetURLRequestContext()); | 508 request_context_getter_->GetURLRequestContext()); |
496 return request_context ? request_context->appcache_service() | 509 return request_context ? request_context->appcache_service() |
497 : NULL; | 510 : NULL; |
498 } | 511 } |
| 512 |
| 513 void BrowsingDataRemover::OnClearedPluginData() { |
| 514 waiting_for_clear_lso_data_ = false; |
| 515 NotifyAndDeleteIfDone(); |
| 516 } |
OLD | NEW |