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

Unified Diff: ios/chrome/browser/browsing_data/ios_browsing_data_counter_factory.cc

Issue 2350773002: Add a browsing data counter factory on iOS (Closed)
Patch Set: Addressed comments Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/chrome/browser/browsing_data/ios_browsing_data_counter_factory.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/browsing_data/ios_browsing_data_counter_factory.cc
diff --git a/ios/chrome/browser/browsing_data/ios_browsing_data_counter_factory.cc b/ios/chrome/browser/browsing_data/ios_browsing_data_counter_factory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..1603efc68902da9959a6c7c8a30fe85de9ae22cb
--- /dev/null
+++ b/ios/chrome/browser/browsing_data/ios_browsing_data_counter_factory.cc
@@ -0,0 +1,55 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ios/chrome/browser/browsing_data/ios_browsing_data_counter_factory.h"
+
+#include "base/bind.h"
+#include "base/bind_helpers.h"
+#include "base/memory/ptr_util.h"
+#include "components/browser_sync/profile_sync_service.h"
+#include "components/browsing_data/core/counters/autofill_counter.h"
+#include "components/browsing_data/core/counters/browsing_data_counter.h"
+#include "components/browsing_data/core/counters/history_counter.h"
+#include "components/browsing_data/core/counters/passwords_counter.h"
+#include "components/browsing_data/core/pref_names.h"
+#include "components/keyed_service/core/service_access_type.h"
+#include "ios/chrome/browser/browser_state/chrome_browser_state.h"
+#include "ios/chrome/browser/experimental_flags.h"
+#include "ios/chrome/browser/history/history_service_factory.h"
+#include "ios/chrome/browser/history/web_history_service_factory.h"
+#include "ios/chrome/browser/passwords/ios_chrome_password_store_factory.h"
+#include "ios/chrome/browser/sync/ios_chrome_profile_sync_service_factory.h"
+#include "ios/chrome/browser/web_data_service_factory.h"
+
+// static
+std::unique_ptr<browsing_data::BrowsingDataCounter>
+IOSBrowsingDataCounterFactory::GetForBrowserStateAndPref(
+ ios::ChromeBrowserState* browser_state,
+ base::StringPiece pref_name) {
+ if (!experimental_flags::IsNewClearBrowsingDataUIEnabled())
+ return nullptr;
+
+ if (pref_name == browsing_data::prefs::kDeleteBrowsingHistory) {
+ return base::MakeUnique<browsing_data::HistoryCounter>(
+ ios::HistoryServiceFactory::GetForBrowserStateIfExists(
+ browser_state, ServiceAccessType::EXPLICIT_ACCESS),
+ base::Bind(&ios::WebHistoryServiceFactory::GetForBrowserState,
+ base::Unretained(browser_state)),
+ IOSChromeProfileSyncServiceFactory::GetForBrowserState(browser_state));
+ }
+
+ if (pref_name == browsing_data::prefs::kDeletePasswords) {
+ return base::MakeUnique<browsing_data::PasswordsCounter>(
+ IOSChromePasswordStoreFactory::GetForBrowserState(
+ browser_state, ServiceAccessType::EXPLICIT_ACCESS));
+ }
+
+ if (pref_name == browsing_data::prefs::kDeleteFormData) {
+ return base::MakeUnique<browsing_data::AutofillCounter>(
+ ios::WebDataServiceFactory::GetAutofillWebDataForBrowserState(
+ browser_state, ServiceAccessType::EXPLICIT_ACCESS));
+ }
+
+ return nullptr;
+}
« no previous file with comments | « ios/chrome/browser/browsing_data/ios_browsing_data_counter_factory.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698