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/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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 [prefs](const std::string& pref) { return prefs->GetBoolean(pref); }); | 312 [prefs](const std::string& pref) { return prefs->GetBoolean(pref); }); |
313 UMA_HISTOGRAM_SPARSE_SLOWLY( | 313 UMA_HISTOGRAM_SPARSE_SLOWLY( |
314 "History.ClearBrowsingData.PasswordsDeletion.AdditionalDatatypesCount", | 314 "History.ClearBrowsingData.PasswordsDeletion.AdditionalDatatypesCount", |
315 checked_other_types); | 315 checked_other_types); |
316 } | 316 } |
317 | 317 |
318 remover_ = BrowsingDataRemoverFactory::GetForBrowserContext(profile); | 318 remover_ = BrowsingDataRemoverFactory::GetForBrowserContext(profile); |
319 remover_->AddObserver(this); | 319 remover_->AddObserver(this); |
320 int period_selected = | 320 int period_selected = |
321 prefs->GetInteger(browsing_data::prefs::kDeleteTimePeriod); | 321 prefs->GetInteger(browsing_data::prefs::kDeleteTimePeriod); |
| 322 browsing_data::TimePeriod time_period = |
| 323 static_cast<browsing_data::TimePeriod>(period_selected); |
| 324 browsing_data::RecordDeletionForPeriod(time_period); |
322 remover_->RemoveAndReply( | 325 remover_->RemoveAndReply( |
323 BrowsingDataRemover::Period( | 326 browsing_data::CalculateBeginDeleteTime(time_period), |
324 static_cast<browsing_data::TimePeriod>(period_selected)), | 327 browsing_data::CalculateEndDeleteTime(time_period), |
325 remove_mask, origin_mask, this); | 328 remove_mask, origin_mask, this); |
326 | 329 |
327 // Store the clear browsing data time. Next time the clear browsing data | 330 // Store the clear browsing data time. Next time the clear browsing data |
328 // dialog is open, this time is used to decide whether to display an info | 331 // dialog is open, this time is used to decide whether to display an info |
329 // banner or not. | 332 // banner or not. |
330 prefs->SetInt64(browsing_data::prefs::kLastClearBrowsingDataTime, | 333 prefs->SetInt64(browsing_data::prefs::kLastClearBrowsingDataTime, |
331 base::Time::Now().ToInternalValue()); | 334 base::Time::Now().ToInternalValue()); |
332 } | 335 } |
333 | 336 |
334 void ClearBrowserDataHandler::OnBrowsingDataRemoverDone() { | 337 void ClearBrowserDataHandler::OnBrowsingDataRemoverDone() { |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 "History.ClearBrowsingData.HistoryNoticeShownInFooterWhenUpdated", | 429 "History.ClearBrowsingData.HistoryNoticeShownInFooterWhenUpdated", |
427 should_show_history_notice_); | 430 should_show_history_notice_); |
428 } | 431 } |
429 | 432 |
430 void ClearBrowserDataHandler::UpdateHistoryDeletionDialog(bool show) { | 433 void ClearBrowserDataHandler::UpdateHistoryDeletionDialog(bool show) { |
431 // This is used by OnBrowsingDataRemoverDone (when the deletion finishes). | 434 // This is used by OnBrowsingDataRemoverDone (when the deletion finishes). |
432 should_show_history_deletion_dialog_ = show; | 435 should_show_history_deletion_dialog_ = show; |
433 } | 436 } |
434 | 437 |
435 } // namespace options | 438 } // namespace options |
OLD | NEW |