Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: chrome/browser/ui/webui/options/clear_browser_data_handler.cc

Issue 2121203002: Add BrowsingDataCounterFactory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move_bd_counters_to_components
Patch Set: Fixed Android code and rebase Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/bind_helpers.h" 13 #include "base/bind_helpers.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/ptr_util.h" 15 #include "base/memory/ptr_util.h"
16 #include "base/metrics/histogram_macros.h" 16 #include "base/metrics/histogram_macros.h"
17 #include "base/metrics/sparse_histogram.h" 17 #include "base/metrics/sparse_histogram.h"
18 #include "base/strings/string16.h" 18 #include "base/strings/string16.h"
19 #include "base/strings/string_number_conversions.h" 19 #include "base/strings/string_number_conversions.h"
20 #include "base/strings/utf_string_conversions.h" 20 #include "base/strings/utf_string_conversions.h"
21 #include "base/values.h" 21 #include "base/values.h"
22 #include "chrome/app/chrome_command_ids.h" 22 #include "chrome/app/chrome_command_ids.h"
23 #include "chrome/browser/browser_process.h" 23 #include "chrome/browser/browser_process.h"
24 #include "chrome/browser/browsing_data/autofill_counter.h" 24 #include "chrome/browser/browsing_data/autofill_counter.h"
25 #include "chrome/browser/browsing_data/browsing_data_counter_factory.h"
25 #include "chrome/browser/browsing_data/browsing_data_counter_utils.h" 26 #include "chrome/browser/browsing_data/browsing_data_counter_utils.h"
26 #include "chrome/browser/browsing_data/browsing_data_helper.h" 27 #include "chrome/browser/browsing_data/browsing_data_helper.h"
27 #include "chrome/browser/browsing_data/browsing_data_remover.h" 28 #include "chrome/browser/browsing_data/browsing_data_remover.h"
28 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" 29 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h"
29 #include "chrome/browser/browsing_data/cache_counter.h" 30 #include "chrome/browser/browsing_data/cache_counter.h"
msramek 2016/07/07 11:55:33 Ditto here - please remove the unnecessary include
ioanap 2016/07/07 16:30:48 Done.
30 #include "chrome/browser/browsing_data/history_counter.h" 31 #include "chrome/browser/browsing_data/history_counter.h"
31 #include "chrome/browser/browsing_data/media_licenses_counter.h" 32 #include "chrome/browser/browsing_data/media_licenses_counter.h"
32 #include "chrome/browser/browsing_data/passwords_counter.h" 33 #include "chrome/browser/browsing_data/passwords_counter.h"
33 #include "chrome/browser/history/web_history_service_factory.h" 34 #include "chrome/browser/history/web_history_service_factory.h"
34 #include "chrome/browser/prefs/incognito_mode_prefs.h" 35 #include "chrome/browser/prefs/incognito_mode_prefs.h"
35 #include "chrome/browser/profiles/profile.h" 36 #include "chrome/browser/profiles/profile.h"
36 #include "chrome/browser/sync/profile_sync_service_factory.h" 37 #include "chrome/browser/sync/profile_sync_service_factory.h"
37 #include "chrome/browser/ui/accelerator_utils.h" 38 #include "chrome/browser/ui/accelerator_utils.h"
38 #include "chrome/common/channel_info.h" 39 #include "chrome/common/channel_info.h"
39 #include "chrome/common/pref_names.h" 40 #include "chrome/common/pref_names.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs(); 87 PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs();
87 clear_plugin_lso_data_enabled_.Init(prefs::kClearPluginLSODataEnabled, prefs); 88 clear_plugin_lso_data_enabled_.Init(prefs::kClearPluginLSODataEnabled, prefs);
88 allow_deleting_browser_history_.Init( 89 allow_deleting_browser_history_.Init(
89 prefs::kAllowDeletingBrowserHistory, 90 prefs::kAllowDeletingBrowserHistory,
90 prefs, 91 prefs,
91 base::Bind(&ClearBrowserDataHandler::OnBrowsingHistoryPrefChanged, 92 base::Bind(&ClearBrowserDataHandler::OnBrowsingHistoryPrefChanged,
92 base::Unretained(this))); 93 base::Unretained(this)));
93 94
94 if (AreCountersEnabled()) { 95 if (AreCountersEnabled()) {
95 Profile* profile = Profile::FromWebUI(web_ui()); 96 Profile* profile = Profile::FromWebUI(web_ui());
96 AddCounter(base::WrapUnique(new PasswordsCounter(profile))); 97 AddCounter(base::WrapUnique(BrowsingDataCounterFactory::GetForPreference(
97 AddCounter(base::WrapUnique(new HistoryCounter(profile))); 98 prefs::kDeletePasswords, profile)));
98 AddCounter(base::WrapUnique(new CacheCounter(profile))); 99 AddCounter(base::WrapUnique(BrowsingDataCounterFactory::GetForPreference(
99 AddCounter(base::WrapUnique(new AutofillCounter(profile))); 100 prefs::kDeleteBrowsingHistory, profile)));
100 AddCounter(base::WrapUnique(new MediaLicensesCounter(profile))); 101 AddCounter(base::WrapUnique(BrowsingDataCounterFactory::GetForPreference(
102 prefs::kDeleteCache, profile)));
103 AddCounter(base::WrapUnique(BrowsingDataCounterFactory::GetForPreference(
104 prefs::kDeleteFormData, profile)));
105 AddCounter(base::WrapUnique(BrowsingDataCounterFactory::GetForPreference(
106 prefs::kDeleteMediaLicenses, profile)));
101 107
102 sync_service_ = ProfileSyncServiceFactory::GetForProfile(profile); 108 sync_service_ = ProfileSyncServiceFactory::GetForProfile(profile);
103 if (sync_service_) 109 if (sync_service_)
104 sync_service_->AddObserver(this); 110 sync_service_->AddObserver(this);
105 } 111 }
106 } 112 }
107 113
108 void ClearBrowserDataHandler::InitializePage() { 114 void ClearBrowserDataHandler::InitializePage() {
109 web_ui()->CallJavascriptFunctionUnsafe( 115 web_ui()->CallJavascriptFunctionUnsafe(
110 "ClearBrowserDataOverlay.createFooter", 116 "ClearBrowserDataOverlay.createFooter",
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 "History.ClearBrowsingData.HistoryNoticeShownInFooterWhenUpdated", 426 "History.ClearBrowsingData.HistoryNoticeShownInFooterWhenUpdated",
421 should_show_history_notice_); 427 should_show_history_notice_);
422 } 428 }
423 429
424 void ClearBrowserDataHandler::UpdateHistoryDeletionDialog(bool show) { 430 void ClearBrowserDataHandler::UpdateHistoryDeletionDialog(bool show) {
425 // This is used by OnBrowsingDataRemoverDone (when the deletion finishes). 431 // This is used by OnBrowsingDataRemoverDone (when the deletion finishes).
426 should_show_history_deletion_dialog_ = show; 432 should_show_history_deletion_dialog_ = show;
427 } 433 }
428 434
429 } // namespace options 435 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698