| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/settings/settings_clear_browsing_data_handler.
h" | 5 #include "chrome/browser/ui/webui/settings/settings_clear_browsing_data_handler.
h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 std::string webui_callback_id; | 199 std::string webui_callback_id; |
| 200 CHECK_EQ(1U, args->GetSize()); | 200 CHECK_EQ(1U, args->GetSize()); |
| 201 CHECK(args->GetString(0, &webui_callback_id)); | 201 CHECK(args->GetString(0, &webui_callback_id)); |
| 202 | 202 |
| 203 BrowsingDataRemover* remover = | 203 BrowsingDataRemover* remover = |
| 204 BrowsingDataRemoverFactory::GetForBrowserContext(profile_); | 204 BrowsingDataRemoverFactory::GetForBrowserContext(profile_); |
| 205 task_observer_ = base::MakeUnique<TaskObserver>( | 205 task_observer_ = base::MakeUnique<TaskObserver>( |
| 206 remover, | 206 remover, |
| 207 base::Bind(&ClearBrowsingDataHandler::OnClearingTaskFinished, | 207 base::Bind(&ClearBrowsingDataHandler::OnClearingTaskFinished, |
| 208 base::Unretained(this), webui_callback_id)); | 208 base::Unretained(this), webui_callback_id)); |
| 209 browsing_data::TimePeriod time_period = |
| 210 static_cast<browsing_data::TimePeriod>(period_selected); |
| 211 browsing_data::RecordDeletionForPeriod(time_period); |
| 209 remover->RemoveAndReply( | 212 remover->RemoveAndReply( |
| 210 BrowsingDataRemover::Period( | 213 browsing_data::CalculateBeginDeleteTime(time_period), |
| 211 static_cast<browsing_data::TimePeriod>(period_selected)), | 214 browsing_data::CalculateEndDeleteTime(time_period), |
| 212 remove_mask, origin_mask, task_observer_.get()); | 215 remove_mask, origin_mask, task_observer_.get()); |
| 213 } | 216 } |
| 214 | 217 |
| 215 void ClearBrowsingDataHandler::OnClearingTaskFinished( | 218 void ClearBrowsingDataHandler::OnClearingTaskFinished( |
| 216 const std::string& webui_callback_id) { | 219 const std::string& webui_callback_id) { |
| 217 PrefService* prefs = profile_->GetPrefs(); | 220 PrefService* prefs = profile_->GetPrefs(); |
| 218 int notice_shown_times = prefs->GetInteger( | 221 int notice_shown_times = prefs->GetInteger( |
| 219 browsing_data::prefs::kClearBrowsingDataHistoryNoticeShownTimes); | 222 browsing_data::prefs::kClearBrowsingDataHistoryNoticeShownTimes); |
| 220 | 223 |
| 221 // When the deletion is complete, we might show an additional dialog with | 224 // When the deletion is complete, we might show an additional dialog with |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 void ClearBrowsingDataHandler::UpdateCounterText( | 320 void ClearBrowsingDataHandler::UpdateCounterText( |
| 318 std::unique_ptr<browsing_data::BrowsingDataCounter::Result> result) { | 321 std::unique_ptr<browsing_data::BrowsingDataCounter::Result> result) { |
| 319 CallJavascriptFunction( | 322 CallJavascriptFunction( |
| 320 "cr.webUIListenerCallback", | 323 "cr.webUIListenerCallback", |
| 321 base::StringValue("update-counter-text"), | 324 base::StringValue("update-counter-text"), |
| 322 base::StringValue(result->source()->GetPrefName()), | 325 base::StringValue(result->source()->GetPrefName()), |
| 323 base::StringValue(GetChromeCounterTextFromResult(result.get()))); | 326 base::StringValue(GetChromeCounterTextFromResult(result.get()))); |
| 324 } | 327 } |
| 325 | 328 |
| 326 } // namespace settings | 329 } // namespace settings |
| OLD | NEW |