| 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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 // Needed because WebUI doesn't handle renderer crashes. See crbug.com/610450. | 255 // Needed because WebUI doesn't handle renderer crashes. See crbug.com/610450. |
| 256 task_observer_.reset(); | 256 task_observer_.reset(); |
| 257 | 257 |
| 258 UpdateSyncState(); | 258 UpdateSyncState(); |
| 259 RefreshHistoryNotice(); | 259 RefreshHistoryNotice(); |
| 260 | 260 |
| 261 // Restart the counters each time the dialog is reopened. | 261 // Restart the counters each time the dialog is reopened. |
| 262 for (const auto& counter : counters_) | 262 for (const auto& counter : counters_) |
| 263 counter->Restart(); | 263 counter->Restart(); |
| 264 | 264 |
| 265 ResolveJavascriptCallback( | 265 ResolveJavascriptCallback(*callback_id, base::Value() /* Promise<void> */); |
| 266 *callback_id, | |
| 267 *base::Value::CreateNullValue() /* Promise<void> */); | |
| 268 } | 266 } |
| 269 | 267 |
| 270 void ClearBrowsingDataHandler::OnStateChanged(syncer::SyncService* sync) { | 268 void ClearBrowsingDataHandler::OnStateChanged(syncer::SyncService* sync) { |
| 271 UpdateSyncState(); | 269 UpdateSyncState(); |
| 272 } | 270 } |
| 273 | 271 |
| 274 void ClearBrowsingDataHandler::UpdateSyncState() { | 272 void ClearBrowsingDataHandler::UpdateSyncState() { |
| 275 CallJavascriptFunction( | 273 CallJavascriptFunction( |
| 276 "cr.webUIListenerCallback", base::Value("update-footer"), | 274 "cr.webUIListenerCallback", base::Value("update-footer"), |
| 277 base::Value(sync_service_ && sync_service_->IsSyncActive()), | 275 base::Value(sync_service_ && sync_service_->IsSyncActive()), |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 | 324 |
| 327 void ClearBrowsingDataHandler::UpdateCounterText( | 325 void ClearBrowsingDataHandler::UpdateCounterText( |
| 328 std::unique_ptr<browsing_data::BrowsingDataCounter::Result> result) { | 326 std::unique_ptr<browsing_data::BrowsingDataCounter::Result> result) { |
| 329 CallJavascriptFunction( | 327 CallJavascriptFunction( |
| 330 "cr.webUIListenerCallback", base::Value("update-counter-text"), | 328 "cr.webUIListenerCallback", base::Value("update-counter-text"), |
| 331 base::Value(result->source()->GetPrefName()), | 329 base::Value(result->source()->GetPrefName()), |
| 332 base::Value(GetChromeCounterTextFromResult(result.get()))); | 330 base::Value(GetChromeCounterTextFromResult(result.get()))); |
| 333 } | 331 } |
| 334 | 332 |
| 335 } // namespace settings | 333 } // namespace settings |
| OLD | NEW |