| 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 16 matching lines...) Expand all Loading... |
| 27 #include "chrome/browser/browsing_data/browsing_data_remover.h" | 27 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
| 28 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" | 28 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" |
| 29 #include "chrome/browser/browsing_data/cache_counter.h" | 29 #include "chrome/browser/browsing_data/cache_counter.h" |
| 30 #include "chrome/browser/browsing_data/history_counter.h" | 30 #include "chrome/browser/browsing_data/history_counter.h" |
| 31 #include "chrome/browser/browsing_data/passwords_counter.h" | 31 #include "chrome/browser/browsing_data/passwords_counter.h" |
| 32 #include "chrome/browser/history/web_history_service_factory.h" | 32 #include "chrome/browser/history/web_history_service_factory.h" |
| 33 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 33 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
| 34 #include "chrome/browser/profiles/profile.h" | 34 #include "chrome/browser/profiles/profile.h" |
| 35 #include "chrome/browser/sync/profile_sync_service_factory.h" | 35 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 36 #include "chrome/browser/ui/accelerator_utils.h" | 36 #include "chrome/browser/ui/accelerator_utils.h" |
| 37 #include "chrome/common/channel_info.h" |
| 37 #include "chrome/common/pref_names.h" | 38 #include "chrome/common/pref_names.h" |
| 38 #include "chrome/grit/generated_resources.h" | 39 #include "chrome/grit/generated_resources.h" |
| 39 #include "chrome/grit/locale_settings.h" | 40 #include "chrome/grit/locale_settings.h" |
| 40 #include "components/browsing_data_ui/history_notice_utils.h" | 41 #include "components/browsing_data_ui/history_notice_utils.h" |
| 41 #include "components/google/core/browser/google_util.h" | 42 #include "components/google/core/browser/google_util.h" |
| 42 #include "components/prefs/pref_service.h" | 43 #include "components/prefs/pref_service.h" |
| 43 #include "content/public/browser/notification_details.h" | 44 #include "content/public/browser/notification_details.h" |
| 44 #include "content/public/browser/web_ui.h" | 45 #include "content/public/browser/web_ui.h" |
| 45 #include "ui/base/accelerators/accelerator.h" | 46 #include "ui/base/accelerators/accelerator.h" |
| 46 #include "ui/base/l10n/l10n_util.h" | 47 #include "ui/base/l10n/l10n_util.h" |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 // If the dialog with history notice has been shown less than | 402 // If the dialog with history notice has been shown less than |
| 402 // |kMaxTimesHistoryNoticeShown| times, we might have to show it when the | 403 // |kMaxTimesHistoryNoticeShown| times, we might have to show it when the |
| 403 // user deletes history. Find out if the conditions are met. | 404 // user deletes history. Find out if the conditions are met. |
| 404 int notice_shown_times = Profile::FromWebUI(web_ui())->GetPrefs()-> | 405 int notice_shown_times = Profile::FromWebUI(web_ui())->GetPrefs()-> |
| 405 GetInteger(prefs::kClearBrowsingDataHistoryNoticeShownTimes); | 406 GetInteger(prefs::kClearBrowsingDataHistoryNoticeShownTimes); |
| 406 | 407 |
| 407 if (notice_shown_times < kMaxTimesHistoryNoticeShown) { | 408 if (notice_shown_times < kMaxTimesHistoryNoticeShown) { |
| 408 browsing_data_ui::ShouldPopupDialogAboutOtherFormsOfBrowsingHistory( | 409 browsing_data_ui::ShouldPopupDialogAboutOtherFormsOfBrowsingHistory( |
| 409 sync_service_, | 410 sync_service_, |
| 410 WebHistoryServiceFactory::GetForProfile(Profile::FromWebUI(web_ui())), | 411 WebHistoryServiceFactory::GetForProfile(Profile::FromWebUI(web_ui())), |
| 412 chrome::GetChannel(), |
| 411 base::Bind(&ClearBrowserDataHandler::UpdateHistoryDeletionDialog, | 413 base::Bind(&ClearBrowserDataHandler::UpdateHistoryDeletionDialog, |
| 412 weak_ptr_factory_.GetWeakPtr())); | 414 weak_ptr_factory_.GetWeakPtr())); |
| 413 } | 415 } |
| 414 } | 416 } |
| 415 | 417 |
| 416 void ClearBrowserDataHandler::UpdateHistoryNotice(bool show) { | 418 void ClearBrowserDataHandler::UpdateHistoryNotice(bool show) { |
| 417 should_show_history_notice_ = show; | 419 should_show_history_notice_ = show; |
| 418 OnStateChanged(); | 420 OnStateChanged(); |
| 419 | 421 |
| 420 UMA_HISTOGRAM_BOOLEAN( | 422 UMA_HISTOGRAM_BOOLEAN( |
| 421 "History.ClearBrowsingData.HistoryNoticeShownInFooterWhenUpdated", | 423 "History.ClearBrowsingData.HistoryNoticeShownInFooterWhenUpdated", |
| 422 should_show_history_notice_); | 424 should_show_history_notice_); |
| 423 } | 425 } |
| 424 | 426 |
| 425 void ClearBrowserDataHandler::UpdateHistoryDeletionDialog(bool show) { | 427 void ClearBrowserDataHandler::UpdateHistoryDeletionDialog(bool show) { |
| 426 // This is used by OnBrowsingDataRemoverDone (when the deletion finishes). | 428 // This is used by OnBrowsingDataRemoverDone (when the deletion finishes). |
| 427 should_show_history_deletion_dialog_ = show; | 429 should_show_history_deletion_dialog_ = show; |
| 428 } | 430 } |
| 429 | 431 |
| 430 } // namespace options | 432 } // namespace options |
| OLD | NEW |