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

Side by Side Diff: chrome/browser/ui/webui/settings/settings_clear_browsing_data_handler.cc

Issue 2585633003: Restart counters when the MD CBD dialog is reopened. (Closed)
Patch Set: Created 4 years 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 | « no previous file | 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 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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 AllowJavascript(); 265 AllowJavascript();
266 const base::Value* callback_id; 266 const base::Value* callback_id;
267 CHECK(args->Get(0, &callback_id)); 267 CHECK(args->Get(0, &callback_id));
268 268
269 // Needed because WebUI doesn't handle renderer crashes. See crbug.com/610450. 269 // Needed because WebUI doesn't handle renderer crashes. See crbug.com/610450.
270 task_observer_.reset(); 270 task_observer_.reset();
271 271
272 OnStateChanged(); 272 OnStateChanged();
273 RefreshHistoryNotice(); 273 RefreshHistoryNotice();
274 274
275 // Restart the counters if the dialog is reopened.
276 for (const auto& counter : counters_)
277 counter->Restart();
tommycli 2016/12/16 17:39:14 how much performance penalty is it to create the c
msramek 2017/01/03 13:56:39 Oops, I didn't realize that AllowJavascript() is c
278
275 ResolveJavascriptCallback( 279 ResolveJavascriptCallback(
276 *callback_id, 280 *callback_id,
277 *base::Value::CreateNullValue() /* Promise<void> */); 281 *base::Value::CreateNullValue() /* Promise<void> */);
278 } 282 }
279 283
280 void ClearBrowsingDataHandler::OnStateChanged() { 284 void ClearBrowsingDataHandler::OnStateChanged() {
281 CallJavascriptFunction( 285 CallJavascriptFunction(
282 "cr.webUIListenerCallback", 286 "cr.webUIListenerCallback",
283 base::StringValue("update-footer"), 287 base::StringValue("update-footer"),
284 base::FundamentalValue(sync_service_ && sync_service_->IsSyncActive()), 288 base::FundamentalValue(sync_service_ && sync_service_->IsSyncActive()),
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 void ClearBrowsingDataHandler::UpdateCounterText( 338 void ClearBrowsingDataHandler::UpdateCounterText(
335 std::unique_ptr<browsing_data::BrowsingDataCounter::Result> result) { 339 std::unique_ptr<browsing_data::BrowsingDataCounter::Result> result) {
336 CallJavascriptFunction( 340 CallJavascriptFunction(
337 "cr.webUIListenerCallback", 341 "cr.webUIListenerCallback",
338 base::StringValue("update-counter-text"), 342 base::StringValue("update-counter-text"),
339 base::StringValue(result->source()->GetPrefName()), 343 base::StringValue(result->source()->GetPrefName()),
340 base::StringValue(GetChromeCounterTextFromResult(result.get()))); 344 base::StringValue(GetChromeCounterTextFromResult(result.get())));
341 } 345 }
342 346
343 } // namespace settings 347 } // namespace settings
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698