| 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" |
| 38 #include "chrome/common/chrome_content_client.h" |
| 37 #include "chrome/common/pref_names.h" | 39 #include "chrome/common/pref_names.h" |
| 38 #include "chrome/grit/generated_resources.h" | 40 #include "chrome/grit/generated_resources.h" |
| 39 #include "chrome/grit/locale_settings.h" | 41 #include "chrome/grit/locale_settings.h" |
| 40 #include "components/browsing_data_ui/history_notice_utils.h" | 42 #include "components/browsing_data_ui/history_notice_utils.h" |
| 41 #include "components/google/core/browser/google_util.h" | 43 #include "components/google/core/browser/google_util.h" |
| 42 #include "components/prefs/pref_service.h" | 44 #include "components/prefs/pref_service.h" |
| 43 #include "content/public/browser/notification_details.h" | 45 #include "content/public/browser/notification_details.h" |
| 44 #include "content/public/browser/web_ui.h" | 46 #include "content/public/browser/web_ui.h" |
| 45 #include "ui/base/accelerators/accelerator.h" | 47 #include "ui/base/accelerators/accelerator.h" |
| 46 #include "ui/base/l10n/l10n_util.h" | 48 #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 | 403 // If the dialog with history notice has been shown less than |
| 402 // |kMaxTimesHistoryNoticeShown| times, we might have to show it when the | 404 // |kMaxTimesHistoryNoticeShown| times, we might have to show it when the |
| 403 // user deletes history. Find out if the conditions are met. | 405 // user deletes history. Find out if the conditions are met. |
| 404 int notice_shown_times = Profile::FromWebUI(web_ui())->GetPrefs()-> | 406 int notice_shown_times = Profile::FromWebUI(web_ui())->GetPrefs()-> |
| 405 GetInteger(prefs::kClearBrowsingDataHistoryNoticeShownTimes); | 407 GetInteger(prefs::kClearBrowsingDataHistoryNoticeShownTimes); |
| 406 | 408 |
| 407 if (notice_shown_times < kMaxTimesHistoryNoticeShown) { | 409 if (notice_shown_times < kMaxTimesHistoryNoticeShown) { |
| 408 browsing_data_ui::ShouldPopupDialogAboutOtherFormsOfBrowsingHistory( | 410 browsing_data_ui::ShouldPopupDialogAboutOtherFormsOfBrowsingHistory( |
| 409 sync_service_, | 411 sync_service_, |
| 410 WebHistoryServiceFactory::GetForProfile(Profile::FromWebUI(web_ui())), | 412 WebHistoryServiceFactory::GetForProfile(Profile::FromWebUI(web_ui())), |
| 413 chrome::GetChannel(), |
| 414 GetUserAgent(), |
| 411 base::Bind(&ClearBrowserDataHandler::UpdateHistoryDeletionDialog, | 415 base::Bind(&ClearBrowserDataHandler::UpdateHistoryDeletionDialog, |
| 412 weak_ptr_factory_.GetWeakPtr())); | 416 weak_ptr_factory_.GetWeakPtr())); |
| 413 } | 417 } |
| 414 } | 418 } |
| 415 | 419 |
| 416 void ClearBrowserDataHandler::UpdateHistoryNotice(bool show) { | 420 void ClearBrowserDataHandler::UpdateHistoryNotice(bool show) { |
| 417 should_show_history_notice_ = show; | 421 should_show_history_notice_ = show; |
| 418 OnStateChanged(); | 422 OnStateChanged(); |
| 419 | 423 |
| 420 UMA_HISTOGRAM_BOOLEAN( | 424 UMA_HISTOGRAM_BOOLEAN( |
| 421 "History.ClearBrowsingData.HistoryNoticeShownInFooterWhenUpdated", | 425 "History.ClearBrowsingData.HistoryNoticeShownInFooterWhenUpdated", |
| 422 should_show_history_notice_); | 426 should_show_history_notice_); |
| 423 } | 427 } |
| 424 | 428 |
| 425 void ClearBrowserDataHandler::UpdateHistoryDeletionDialog(bool show) { | 429 void ClearBrowserDataHandler::UpdateHistoryDeletionDialog(bool show) { |
| 426 // This is used by OnBrowsingDataRemoverDone (when the deletion finishes). | 430 // This is used by OnBrowsingDataRemoverDone (when the deletion finishes). |
| 427 should_show_history_deletion_dialog_ = show; | 431 should_show_history_deletion_dialog_ = show; |
| 428 } | 432 } |
| 429 | 433 |
| 430 } // namespace options | 434 } // namespace options |
| OLD | NEW |