| 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 <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 prefs->GetBoolean(prefs::kDeleteBrowsingHistory) && | 343 prefs->GetBoolean(prefs::kDeleteBrowsingHistory) && |
| 344 // 3. The notice has been shown less than |kMaxTimesHistoryNoticeShown|. | 344 // 3. The notice has been shown less than |kMaxTimesHistoryNoticeShown|. |
| 345 notice_shown_times < kMaxTimesHistoryNoticeShown; | 345 notice_shown_times < kMaxTimesHistoryNoticeShown; |
| 346 | 346 |
| 347 if (show_notice) { | 347 if (show_notice) { |
| 348 // Increment the preference. | 348 // Increment the preference. |
| 349 prefs->SetInteger(prefs::kClearBrowsingDataHistoryNoticeShownTimes, | 349 prefs->SetInteger(prefs::kClearBrowsingDataHistoryNoticeShownTimes, |
| 350 notice_shown_times + 1); | 350 notice_shown_times + 1); |
| 351 } | 351 } |
| 352 | 352 |
| 353 UMA_HISTOGRAM_BOOLEAN( |
| 354 "History.ClearBrowsingData.ShownHistoryNoticeAfterClearing", show_notice); |
| 355 |
| 353 web_ui()->CallJavascriptFunction( | 356 web_ui()->CallJavascriptFunction( |
| 354 "ClearBrowserDataOverlay.doneClearing", | 357 "ClearBrowserDataOverlay.doneClearing", |
| 355 base::FundamentalValue(show_notice)); | 358 base::FundamentalValue(show_notice)); |
| 356 } | 359 } |
| 357 | 360 |
| 358 void ClearBrowserDataHandler::OnBrowsingHistoryPrefChanged() { | 361 void ClearBrowserDataHandler::OnBrowsingHistoryPrefChanged() { |
| 359 web_ui()->CallJavascriptFunction( | 362 web_ui()->CallJavascriptFunction( |
| 360 "ClearBrowserDataOverlay.setAllowDeletingHistory", | 363 "ClearBrowserDataOverlay.setAllowDeletingHistory", |
| 361 base::FundamentalValue(*allow_deleting_browser_history_)); | 364 base::FundamentalValue(*allow_deleting_browser_history_)); |
| 362 } | 365 } |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 sync_service_, | 409 sync_service_, |
| 407 WebHistoryServiceFactory::GetForProfile(Profile::FromWebUI(web_ui())), | 410 WebHistoryServiceFactory::GetForProfile(Profile::FromWebUI(web_ui())), |
| 408 base::Bind(&ClearBrowserDataHandler::UpdateHistoryDeletionDialog, | 411 base::Bind(&ClearBrowserDataHandler::UpdateHistoryDeletionDialog, |
| 409 weak_ptr_factory_.GetWeakPtr())); | 412 weak_ptr_factory_.GetWeakPtr())); |
| 410 } | 413 } |
| 411 } | 414 } |
| 412 | 415 |
| 413 void ClearBrowserDataHandler::UpdateHistoryNotice(bool show) { | 416 void ClearBrowserDataHandler::UpdateHistoryNotice(bool show) { |
| 414 should_show_history_notice_ = show; | 417 should_show_history_notice_ = show; |
| 415 OnStateChanged(); | 418 OnStateChanged(); |
| 419 |
| 420 UMA_HISTOGRAM_BOOLEAN( |
| 421 "History.ClearBrowsingData.HistoryNoticeShownInFooterWhenUpdated", |
| 422 should_show_history_notice_); |
| 416 } | 423 } |
| 417 | 424 |
| 418 void ClearBrowserDataHandler::UpdateHistoryDeletionDialog(bool show) { | 425 void ClearBrowserDataHandler::UpdateHistoryDeletionDialog(bool show) { |
| 419 // This is used by OnBrowsingDataRemoverDone (when the deletion finishes). | 426 // This is used by OnBrowsingDataRemoverDone (when the deletion finishes). |
| 420 should_show_history_deletion_dialog_ = show; | 427 should_show_history_deletion_dialog_ = show; |
| 421 } | 428 } |
| 422 | 429 |
| 423 } // namespace options | 430 } // namespace options |
| OLD | NEW |