| 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 if (since_clear < base::TimeDelta::FromHours(base::Time::kHoursPerDay)) { | 138 if (since_clear < base::TimeDelta::FromHours(base::Time::kHoursPerDay)) { |
| 139 ui::Accelerator acc = chrome::GetPrimaryChromeAcceleratorForCommandId( | 139 ui::Accelerator acc = chrome::GetPrimaryChromeAcceleratorForCommandId( |
| 140 IDC_NEW_INCOGNITO_WINDOW); | 140 IDC_NEW_INCOGNITO_WINDOW); |
| 141 DCHECK_NE(ui::VKEY_UNKNOWN, acc.key_code()); | 141 DCHECK_NE(ui::VKEY_UNKNOWN, acc.key_code()); |
| 142 text = l10n_util::GetStringFUTF16(IDS_CLEAR_BROWSING_DATA_INFO_BAR_TEXT, | 142 text = l10n_util::GetStringFUTF16(IDS_CLEAR_BROWSING_DATA_INFO_BAR_TEXT, |
| 143 acc.GetShortcutText()); | 143 acc.GetShortcutText()); |
| 144 } | 144 } |
| 145 } | 145 } |
| 146 | 146 |
| 147 web_ui()->CallJavascriptFunctionUnsafe( | 147 web_ui()->CallJavascriptFunctionUnsafe( |
| 148 "ClearBrowserDataOverlay.setBannerText", base::StringValue(text)); | 148 "ClearBrowserDataOverlay.setBannerText", base::Value(text)); |
| 149 } | 149 } |
| 150 | 150 |
| 151 void ClearBrowserDataHandler::OnPageOpened(const base::ListValue* value) { | 151 void ClearBrowserDataHandler::OnPageOpened(const base::ListValue* value) { |
| 152 for (const auto& counter : counters_) { | 152 for (const auto& counter : counters_) { |
| 153 DCHECK(AreCountersEnabled()); | 153 DCHECK(AreCountersEnabled()); |
| 154 counter->Restart(); | 154 counter->Restart(); |
| 155 } | 155 } |
| 156 } | 156 } |
| 157 | 157 |
| 158 void ClearBrowserDataHandler::GetLocalizedValues( | 158 void ClearBrowserDataHandler::GetLocalizedValues( |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 base::Bind(&ClearBrowserDataHandler::UpdateCounterText, | 379 base::Bind(&ClearBrowserDataHandler::UpdateCounterText, |
| 380 base::Unretained(this))); | 380 base::Unretained(this))); |
| 381 counters_.push_back(std::move(counter)); | 381 counters_.push_back(std::move(counter)); |
| 382 } | 382 } |
| 383 | 383 |
| 384 void ClearBrowserDataHandler::UpdateCounterText( | 384 void ClearBrowserDataHandler::UpdateCounterText( |
| 385 std::unique_ptr<browsing_data::BrowsingDataCounter::Result> result) { | 385 std::unique_ptr<browsing_data::BrowsingDataCounter::Result> result) { |
| 386 DCHECK(AreCountersEnabled()); | 386 DCHECK(AreCountersEnabled()); |
| 387 web_ui()->CallJavascriptFunctionUnsafe( | 387 web_ui()->CallJavascriptFunctionUnsafe( |
| 388 "ClearBrowserDataOverlay.updateCounter", | 388 "ClearBrowserDataOverlay.updateCounter", |
| 389 base::StringValue(result->source()->GetPrefName()), | 389 base::Value(result->source()->GetPrefName()), |
| 390 base::StringValue(GetChromeCounterTextFromResult(result.get()))); | 390 base::Value(GetChromeCounterTextFromResult(result.get()))); |
| 391 } | 391 } |
| 392 | 392 |
| 393 void ClearBrowserDataHandler::OnStateChanged(syncer::SyncService* sync) { | 393 void ClearBrowserDataHandler::OnStateChanged(syncer::SyncService* sync) { |
| 394 UpdateSyncState(); | 394 UpdateSyncState(); |
| 395 } | 395 } |
| 396 | 396 |
| 397 void ClearBrowserDataHandler::UpdateSyncState() { | 397 void ClearBrowserDataHandler::UpdateSyncState() { |
| 398 web_ui()->CallJavascriptFunctionUnsafe( | 398 web_ui()->CallJavascriptFunctionUnsafe( |
| 399 "ClearBrowserDataOverlay.updateSyncWarningAndHistoryFooter", | 399 "ClearBrowserDataOverlay.updateSyncWarningAndHistoryFooter", |
| 400 base::Value(sync_service_ && sync_service_->IsSyncActive()), | 400 base::Value(sync_service_ && sync_service_->IsSyncActive()), |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 "History.ClearBrowsingData.HistoryNoticeShownInFooterWhenUpdated", | 432 "History.ClearBrowsingData.HistoryNoticeShownInFooterWhenUpdated", |
| 433 should_show_history_notice_); | 433 should_show_history_notice_); |
| 434 } | 434 } |
| 435 | 435 |
| 436 void ClearBrowserDataHandler::UpdateHistoryDeletionDialog(bool show) { | 436 void ClearBrowserDataHandler::UpdateHistoryDeletionDialog(bool show) { |
| 437 // This is used by OnBrowsingDataRemoverDone (when the deletion finishes). | 437 // This is used by OnBrowsingDataRemoverDone (when the deletion finishes). |
| 438 should_show_history_deletion_dialog_ = show; | 438 should_show_history_deletion_dialog_ = show; |
| 439 } | 439 } |
| 440 | 440 |
| 441 } // namespace options | 441 } // namespace options |
| OLD | NEW |