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

Unified Diff: chrome/browser/prefs/profile_pref_store_manager.cc

Issue 2782803002: Move tracked prefs into services/preferences/tracked. (Closed)
Patch Set: rebase Created 3 years, 9 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
Index: chrome/browser/prefs/profile_pref_store_manager.cc
diff --git a/chrome/browser/prefs/profile_pref_store_manager.cc b/chrome/browser/prefs/profile_pref_store_manager.cc
index 985ab156c5468e052537d636adf0d45b6158eedc..b1408398ecc9d271f0ec47b43c669083d79b0c81 100644
--- a/chrome/browser/prefs/profile_pref_store_manager.cc
+++ b/chrome/browser/prefs/profile_pref_store_manager.cc
@@ -21,20 +21,24 @@
#include "components/prefs/json_pref_store.h"
#include "components/prefs/persistent_pref_store.h"
#include "components/prefs/pref_registry_simple.h"
-#include "components/user_prefs/tracked/pref_hash_store_impl.h"
-#include "components/user_prefs/tracked/segregated_pref_store.h"
-#include "components/user_prefs/tracked/tracked_preferences_migration.h"
#include "services/preferences/public/cpp/persistent_pref_store_client.h"
#include "services/preferences/public/interfaces/preferences.mojom.h"
+#include "services/preferences/tracked/pref_hash_filter.h"
+#include "services/preferences/tracked/pref_hash_store_impl.h"
+#include "services/preferences/tracked/segregated_pref_store.h"
+#include "services/preferences/tracked/tracked_preferences_migration.h"
#include "services/service_manager/public/cpp/connector.h"
#if defined(OS_WIN)
#include "chrome/install_static/install_util.h"
-#include "components/user_prefs/tracked/registry_hash_store_contents_win.h"
+#include "services/preferences/tracked/registry_hash_store_contents_win.h"
#endif
namespace {
+using EnforcementLevel =
+ prefs::mojom::TrackedPreferenceMetadata::EnforcementLevel;
+
void RemoveValueSilently(const base::WeakPtr<JsonPrefStore> pref_store,
const std::string& key) {
if (pref_store) {
@@ -63,14 +67,14 @@ const bool ProfilePrefStoreManager::kPlatformSupportsPreferenceTracking =
ProfilePrefStoreManager::ProfilePrefStoreManager(
const base::FilePath& profile_path,
- const std::vector<PrefHashFilter::TrackedPreferenceMetadata>&
+ std::vector<prefs::mojom::TrackedPreferenceMetadataPtr>
tracking_configuration,
size_t reporting_ids_count,
const std::string& seed,
const std::string& legacy_device_id,
PrefService* local_state)
: profile_path_(profile_path),
- tracking_configuration_(tracking_configuration),
+ tracking_configuration_(std::move(tracking_configuration)),
reporting_ids_count_(reporting_ids_count),
seed_(seed),
legacy_device_id_(legacy_device_id),
@@ -122,25 +126,22 @@ PersistentPrefStore* ProfilePrefStoreManager::CreateProfilePrefStore(
std::unique_ptr<PrefFilter>());
}
- std::vector<PrefHashFilter::TrackedPreferenceMetadata>
+ std::vector<prefs::mojom::TrackedPreferenceMetadataPtr>
unprotected_configuration;
- std::vector<PrefHashFilter::TrackedPreferenceMetadata>
+ std::vector<prefs::mojom::TrackedPreferenceMetadataPtr>
protected_configuration;
std::set<std::string> protected_pref_names;
std::set<std::string> unprotected_pref_names;
- for (std::vector<PrefHashFilter::TrackedPreferenceMetadata>::const_iterator
- it = tracking_configuration_.begin();
- it != tracking_configuration_.end();
- ++it) {
- if (it->enforcement_level >
- PrefHashFilter::EnforcementLevel::NO_ENFORCEMENT) {
- protected_configuration.push_back(*it);
- protected_pref_names.insert(it->name);
+ for (auto& metadata : tracking_configuration_) {
+ if (metadata->enforcement_level > EnforcementLevel::NO_ENFORCEMENT) {
+ protected_pref_names.insert(metadata->name);
+ protected_configuration.push_back(std::move(metadata));
} else {
- unprotected_configuration.push_back(*it);
- unprotected_pref_names.insert(it->name);
+ unprotected_pref_names.insert(metadata->name);
+ unprotected_configuration.push_back(std::move(metadata));
}
}
+ tracking_configuration_.clear();
std::unique_ptr<PrefHashFilter> unprotected_pref_hash_filter(
new PrefHashFilter(GetPrefHashStore(false),
« no previous file with comments | « chrome/browser/prefs/profile_pref_store_manager.h ('k') | chrome/browser/prefs/profile_pref_store_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698