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

Side by Side Diff: chrome/browser/ui/webui/options/clear_browser_data_handler.cc

Issue 2657673004: Add shutdown notification and service refs to SyncServiceObserver. (Closed)
Patch Set: Chromeos fix Created 3 years, 10 months 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
OLDNEW
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
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 UpdateSyncState();
396 }
397
398 void ClearBrowserDataHandler::UpdateSyncState() {
395 web_ui()->CallJavascriptFunctionUnsafe( 399 web_ui()->CallJavascriptFunctionUnsafe(
396 "ClearBrowserDataOverlay.updateSyncWarningAndHistoryFooter", 400 "ClearBrowserDataOverlay.updateSyncWarningAndHistoryFooter",
397 base::FundamentalValue(sync_service_ && sync_service_->IsSyncActive()), 401 base::FundamentalValue(sync_service_ && sync_service_->IsSyncActive()),
398 base::FundamentalValue(should_show_history_notice_)); 402 base::FundamentalValue(should_show_history_notice_));
399 } 403 }
400 404
401 void ClearBrowserDataHandler::RefreshHistoryNotice() { 405 void ClearBrowserDataHandler::RefreshHistoryNotice() {
402 browsing_data::ShouldShowNoticeAboutOtherFormsOfBrowsingHistory( 406 browsing_data::ShouldShowNoticeAboutOtherFormsOfBrowsingHistory(
403 sync_service_, 407 sync_service_,
404 WebHistoryServiceFactory::GetForProfile(Profile::FromWebUI(web_ui())), 408 WebHistoryServiceFactory::GetForProfile(Profile::FromWebUI(web_ui())),
(...skipping 11 matching lines...) Expand all
416 sync_service_, 420 sync_service_,
417 WebHistoryServiceFactory::GetForProfile(Profile::FromWebUI(web_ui())), 421 WebHistoryServiceFactory::GetForProfile(Profile::FromWebUI(web_ui())),
418 chrome::GetChannel(), 422 chrome::GetChannel(),
419 base::Bind(&ClearBrowserDataHandler::UpdateHistoryDeletionDialog, 423 base::Bind(&ClearBrowserDataHandler::UpdateHistoryDeletionDialog,
420 weak_ptr_factory_.GetWeakPtr())); 424 weak_ptr_factory_.GetWeakPtr()));
421 } 425 }
422 } 426 }
423 427
424 void ClearBrowserDataHandler::UpdateHistoryNotice(bool show) { 428 void ClearBrowserDataHandler::UpdateHistoryNotice(bool show) {
425 should_show_history_notice_ = show; 429 should_show_history_notice_ = show;
426 OnStateChanged(); 430 UpdateSyncState();
427 431
428 UMA_HISTOGRAM_BOOLEAN( 432 UMA_HISTOGRAM_BOOLEAN(
429 "History.ClearBrowsingData.HistoryNoticeShownInFooterWhenUpdated", 433 "History.ClearBrowsingData.HistoryNoticeShownInFooterWhenUpdated",
430 should_show_history_notice_); 434 should_show_history_notice_);
431 } 435 }
432 436
433 void ClearBrowserDataHandler::UpdateHistoryDeletionDialog(bool show) { 437 void ClearBrowserDataHandler::UpdateHistoryDeletionDialog(bool show) {
434 // This is used by OnBrowsingDataRemoverDone (when the deletion finishes). 438 // This is used by OnBrowsingDataRemoverDone (when the deletion finishes).
435 should_show_history_deletion_dialog_ = show; 439 should_show_history_deletion_dialog_ = show;
436 } 440 }
437 441
438 } // namespace options 442 } // namespace options
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options/clear_browser_data_handler.h ('k') | chrome/browser/ui/webui/options/manage_profile_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698