Chromium Code Reviews| 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/browsing_data/browsing_data_remover.h" | 5 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 235 | 235 |
| 236 if (remove_mask & REMOVE_HISTORY) { | 236 if (remove_mask & REMOVE_HISTORY) { |
| 237 HistoryService* history_service = HistoryServiceFactory::GetForProfile( | 237 HistoryService* history_service = HistoryServiceFactory::GetForProfile( |
| 238 profile_, Profile::EXPLICIT_ACCESS); | 238 profile_, Profile::EXPLICIT_ACCESS); |
| 239 if (history_service) { | 239 if (history_service) { |
| 240 std::set<GURL> restrict_urls; | 240 std::set<GURL> restrict_urls; |
| 241 if (!remove_origin_.is_empty()) | 241 if (!remove_origin_.is_empty()) |
| 242 restrict_urls.insert(remove_origin_); | 242 restrict_urls.insert(remove_origin_); |
| 243 content::RecordAction(UserMetricsAction("ClearBrowsingData_History")); | 243 content::RecordAction(UserMetricsAction("ClearBrowsingData_History")); |
| 244 waiting_for_clear_history_ = true; | 244 waiting_for_clear_history_ = true; |
| 245 // The history service doesn't correctly handle delete_end_. Work around | |
| 246 // it by always passing a NULL time here (it will delete everything until | |
| 247 // delete_begin_). | |
| 245 history_service->ExpireHistoryBetween(restrict_urls, | 248 history_service->ExpireHistoryBetween(restrict_urls, |
| 246 delete_begin_, delete_end_, | 249 delete_begin_, base::Time(), |
|
rohitrao (ping after 24h)
2012/08/30 15:25:16
This hack only works if callers always pass Time::
marja
2012/08/30 15:28:44
Via the extension API it's possible to invoke Brow
| |
| 247 &request_consumer_, | 250 &request_consumer_, |
| 248 base::Bind(&BrowsingDataRemover::OnHistoryDeletionDone, | 251 base::Bind(&BrowsingDataRemover::OnHistoryDeletionDone, |
| 249 base::Unretained(this))); | 252 base::Unretained(this))); |
| 250 } | 253 } |
| 251 | 254 |
| 252 // Need to clear the host cache and accumulated speculative data, as it also | 255 // Need to clear the host cache and accumulated speculative data, as it also |
| 253 // reveals some history: we have no mechanism to track when these items were | 256 // reveals some history: we have no mechanism to track when these items were |
| 254 // created, so we'll clear them all. Better safe than sorry. | 257 // created, so we'll clear them all. Better safe than sorry. |
| 255 if (g_browser_process->io_thread()) { | 258 if (g_browser_process->io_thread()) { |
| 256 waiting_for_clear_networking_history_ = true; | 259 waiting_for_clear_networking_history_ = true; |
| (...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 926 BrowserThread::UI, FROM_HERE, | 929 BrowserThread::UI, FROM_HERE, |
| 927 base::Bind(&BrowsingDataRemover::OnClearedFormData, | 930 base::Bind(&BrowsingDataRemover::OnClearedFormData, |
| 928 base::Unretained(this))); | 931 base::Unretained(this))); |
| 929 } | 932 } |
| 930 | 933 |
| 931 void BrowsingDataRemover::OnClearedFormData() { | 934 void BrowsingDataRemover::OnClearedFormData() { |
| 932 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 935 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 933 waiting_for_clear_form_ = false; | 936 waiting_for_clear_form_ = false; |
| 934 NotifyAndDeleteIfDone(); | 937 NotifyAndDeleteIfDone(); |
| 935 } | 938 } |
| OLD | NEW |