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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
76 sync_service_(nullptr), | 76 sync_service_(nullptr), |
77 should_show_history_notice_(false), | 77 should_show_history_notice_(false), |
78 should_show_history_deletion_dialog_(false), | 78 should_show_history_deletion_dialog_(false), |
79 weak_ptr_factory_(this) { | 79 weak_ptr_factory_(this) { |
80 } | 80 } |
81 | 81 |
82 ClearBrowserDataHandler::~ClearBrowserDataHandler() { | 82 ClearBrowserDataHandler::~ClearBrowserDataHandler() { |
83 if (remover_) | 83 if (remover_) |
84 remover_->RemoveObserver(this); | 84 remover_->RemoveObserver(this); |
85 if (sync_service_) | 85 if (sync_service_) |
86 sync_service_->RemoveObserver(this); | 86 sync_service_->RemoveObserver(this); |
skym
2017/01/26 23:43:23
So many of these uses could benefit from the Scope
| |
87 } | 87 } |
88 | 88 |
89 void ClearBrowserDataHandler::InitializeHandler() { | 89 void ClearBrowserDataHandler::InitializeHandler() { |
90 PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs(); | 90 PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs(); |
91 clear_plugin_lso_data_enabled_.Init(prefs::kClearPluginLSODataEnabled, prefs); | 91 clear_plugin_lso_data_enabled_.Init(prefs::kClearPluginLSODataEnabled, prefs); |
92 allow_deleting_browser_history_.Init( | 92 allow_deleting_browser_history_.Init( |
93 prefs::kAllowDeletingBrowserHistory, | 93 prefs::kAllowDeletingBrowserHistory, |
94 prefs, | 94 prefs, |
95 base::Bind(&ClearBrowserDataHandler::OnBrowsingHistoryPrefChanged, | 95 base::Bind(&ClearBrowserDataHandler::OnBrowsingHistoryPrefChanged, |
96 base::Unretained(this))); | 96 base::Unretained(this))); |
(...skipping 287 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 24 matching lines...) Expand all Loading... | |
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 |