Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(302)

Side by Side Diff: chrome/browser/ui/webui/options/clear_browser_data_handler.cc

Issue 2175703002: Implement a task scheduler for BrowsingDataRemover (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bdr-race-condition
Patch Set: Formatting. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/ssl/chrome_ssl_host_state_delegate_test.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/ui/webui/options/clear_browser_data_handler.h" 5 #include "chrome/browser/ui/webui/options/clear_browser_data_handler.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 [prefs](const std::string& pref) { return prefs->GetBoolean(pref); }); 311 [prefs](const std::string& pref) { return prefs->GetBoolean(pref); });
312 UMA_HISTOGRAM_SPARSE_SLOWLY( 312 UMA_HISTOGRAM_SPARSE_SLOWLY(
313 "History.ClearBrowsingData.PasswordsDeletion.AdditionalDatatypesCount", 313 "History.ClearBrowsingData.PasswordsDeletion.AdditionalDatatypesCount",
314 checked_other_types); 314 checked_other_types);
315 } 315 }
316 316
317 remover_ = BrowsingDataRemoverFactory::GetForBrowserContext(profile); 317 remover_ = BrowsingDataRemoverFactory::GetForBrowserContext(profile);
318 remover_->AddObserver(this); 318 remover_->AddObserver(this);
319 int period_selected = 319 int period_selected =
320 prefs->GetInteger(browsing_data::prefs::kDeleteTimePeriod); 320 prefs->GetInteger(browsing_data::prefs::kDeleteTimePeriod);
321 remover_->Remove(BrowsingDataRemover::Period( 321 remover_->RemoveAndReply(
322 static_cast<browsing_data::TimePeriod>(period_selected)), 322 BrowsingDataRemover::Period(
323 remove_mask, origin_mask); 323 static_cast<browsing_data::TimePeriod>(period_selected)),
324 remove_mask, origin_mask, this);
324 325
325 // Store the clear browsing data time. Next time the clear browsing data 326 // Store the clear browsing data time. Next time the clear browsing data
326 // dialog is open, this time is used to decide whether to display an info 327 // dialog is open, this time is used to decide whether to display an info
327 // banner or not. 328 // banner or not.
328 prefs->SetInt64(prefs::kLastClearBrowsingDataTime, 329 prefs->SetInt64(prefs::kLastClearBrowsingDataTime,
329 base::Time::Now().ToInternalValue()); 330 base::Time::Now().ToInternalValue());
330 } 331 }
331 332
332 void ClearBrowserDataHandler::OnBrowsingDataRemoverDone() { 333 void ClearBrowserDataHandler::OnBrowsingDataRemoverDone() {
333 remover_->RemoveObserver(this); 334 remover_->RemoveObserver(this);
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 "History.ClearBrowsingData.HistoryNoticeShownInFooterWhenUpdated", 424 "History.ClearBrowsingData.HistoryNoticeShownInFooterWhenUpdated",
424 should_show_history_notice_); 425 should_show_history_notice_);
425 } 426 }
426 427
427 void ClearBrowserDataHandler::UpdateHistoryDeletionDialog(bool show) { 428 void ClearBrowserDataHandler::UpdateHistoryDeletionDialog(bool show) {
428 // This is used by OnBrowsingDataRemoverDone (when the deletion finishes). 429 // This is used by OnBrowsingDataRemoverDone (when the deletion finishes).
429 should_show_history_deletion_dialog_ = show; 430 should_show_history_deletion_dialog_ = show;
430 } 431 }
431 432
432 } // namespace options 433 } // namespace options
OLDNEW
« no previous file with comments | « chrome/browser/ssl/chrome_ssl_host_state_delegate_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698