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 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
384 | 384 |
385 void ClearBrowserDataHandler::UpdateCounterText( | 385 void ClearBrowserDataHandler::UpdateCounterText( |
386 std::unique_ptr<browsing_data::BrowsingDataCounter::Result> result) { | 386 std::unique_ptr<browsing_data::BrowsingDataCounter::Result> result) { |
387 DCHECK(AreCountersEnabled()); | 387 DCHECK(AreCountersEnabled()); |
388 web_ui()->CallJavascriptFunctionUnsafe( | 388 web_ui()->CallJavascriptFunctionUnsafe( |
389 "ClearBrowserDataOverlay.updateCounter", | 389 "ClearBrowserDataOverlay.updateCounter", |
390 base::StringValue(result->source()->GetPrefName()), | 390 base::StringValue(result->source()->GetPrefName()), |
391 base::StringValue(GetChromeCounterTextFromResult(result.get()))); | 391 base::StringValue(GetChromeCounterTextFromResult(result.get()))); |
392 } | 392 } |
393 | 393 |
394 void ClearBrowserDataHandler::OnStateChanged() { | 394 void ClearBrowserDataHandler::OnStateChanged(syncer::SyncService* sync) { |
395 web_ui()->CallJavascriptFunctionUnsafe( | 395 web_ui()->CallJavascriptFunctionUnsafe( |
396 "ClearBrowserDataOverlay.updateSyncWarningAndHistoryFooter", | 396 "ClearBrowserDataOverlay.updateSyncWarningAndHistoryFooter", |
397 base::FundamentalValue(sync_service_ && sync_service_->IsSyncActive()), | 397 base::FundamentalValue(sync_service_ && sync_service_->IsSyncActive()), |
398 base::FundamentalValue(should_show_history_notice_)); | 398 base::FundamentalValue(should_show_history_notice_)); |
399 } | 399 } |
400 | 400 |
401 void ClearBrowserDataHandler::RefreshHistoryNotice() { | 401 void ClearBrowserDataHandler::RefreshHistoryNotice() { |
402 browsing_data::ShouldShowNoticeAboutOtherFormsOfBrowsingHistory( | 402 browsing_data::ShouldShowNoticeAboutOtherFormsOfBrowsingHistory( |
403 sync_service_, | 403 sync_service_, |
404 WebHistoryServiceFactory::GetForProfile(Profile::FromWebUI(web_ui())), | 404 WebHistoryServiceFactory::GetForProfile(Profile::FromWebUI(web_ui())), |
(...skipping 11 matching lines...) Expand all Loading... | |
416 sync_service_, | 416 sync_service_, |
417 WebHistoryServiceFactory::GetForProfile(Profile::FromWebUI(web_ui())), | 417 WebHistoryServiceFactory::GetForProfile(Profile::FromWebUI(web_ui())), |
418 chrome::GetChannel(), | 418 chrome::GetChannel(), |
419 base::Bind(&ClearBrowserDataHandler::UpdateHistoryDeletionDialog, | 419 base::Bind(&ClearBrowserDataHandler::UpdateHistoryDeletionDialog, |
420 weak_ptr_factory_.GetWeakPtr())); | 420 weak_ptr_factory_.GetWeakPtr())); |
421 } | 421 } |
422 } | 422 } |
423 | 423 |
424 void ClearBrowserDataHandler::UpdateHistoryNotice(bool show) { | 424 void ClearBrowserDataHandler::UpdateHistoryNotice(bool show) { |
425 should_show_history_notice_ = show; | 425 should_show_history_notice_ = show; |
426 OnStateChanged(); | 426 OnStateChanged(nullptr); |
sky
2017/01/27 16:29:44
This seems error prone. I recommend having OnState
Steven Holte
2017/01/27 20:11:45
Done.
| |
427 | 427 |
428 UMA_HISTOGRAM_BOOLEAN( | 428 UMA_HISTOGRAM_BOOLEAN( |
429 "History.ClearBrowsingData.HistoryNoticeShownInFooterWhenUpdated", | 429 "History.ClearBrowsingData.HistoryNoticeShownInFooterWhenUpdated", |
430 should_show_history_notice_); | 430 should_show_history_notice_); |
431 } | 431 } |
432 | 432 |
433 void ClearBrowserDataHandler::UpdateHistoryDeletionDialog(bool show) { | 433 void ClearBrowserDataHandler::UpdateHistoryDeletionDialog(bool show) { |
434 // This is used by OnBrowsingDataRemoverDone (when the deletion finishes). | 434 // This is used by OnBrowsingDataRemoverDone (when the deletion finishes). |
435 should_show_history_deletion_dialog_ = show; | 435 should_show_history_deletion_dialog_ = show; |
436 } | 436 } |
437 | 437 |
438 } // namespace options | 438 } // namespace options |
OLD | NEW |