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

Unified Diff: chrome/browser/prefs/tracked/dictionary_hash_store_contents.cc

Issue 1227973003: Componentize //chrome/browser/prefs/tracked. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 5 years, 4 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/tracked/dictionary_hash_store_contents.cc
diff --git a/chrome/browser/prefs/tracked/dictionary_hash_store_contents.cc b/chrome/browser/prefs/tracked/dictionary_hash_store_contents.cc
deleted file mode 100644
index 567b9c8121c0ebb175544672b694a4ffbcf1db5b..0000000000000000000000000000000000000000
--- a/chrome/browser/prefs/tracked/dictionary_hash_store_contents.cc
+++ /dev/null
@@ -1,94 +0,0 @@
-// Copyright (c) 2014 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 "chrome/browser/prefs/tracked/dictionary_hash_store_contents.h"
-
-#include "base/callback.h"
-#include "base/logging.h"
-#include "base/prefs/persistent_pref_store.h"
-#include "base/values.h"
-#include "components/pref_registry/pref_registry_syncable.h"
-
-namespace {
-
-const char kPreferenceMACs[] = "protection.macs";
-const char kSuperMACPref[] = "protection.super_mac";
-
-class MutablePreferenceMacDictionary
- : public HashStoreContents::MutableDictionary {
- public:
- explicit MutablePreferenceMacDictionary(base::DictionaryValue* storage);
-
- // MutableDictionary implementation
- base::DictionaryValue* operator->() override;
-
- private:
- base::DictionaryValue* storage_;
-
- DISALLOW_COPY_AND_ASSIGN(MutablePreferenceMacDictionary);
-};
-
-MutablePreferenceMacDictionary::MutablePreferenceMacDictionary(
- base::DictionaryValue* storage)
- : storage_(storage) {
-}
-
-base::DictionaryValue* MutablePreferenceMacDictionary::operator->() {
- base::DictionaryValue* mac_dictionary = NULL;
-
- if (!storage_->GetDictionary(kPreferenceMACs, &mac_dictionary)) {
- mac_dictionary = new base::DictionaryValue;
- storage_->Set(kPreferenceMACs, mac_dictionary);
- }
-
- return mac_dictionary;
-}
-
-} // namespace
-
-DictionaryHashStoreContents::DictionaryHashStoreContents(
- base::DictionaryValue* storage)
- : storage_(storage) {
-}
-
-// static
-void DictionaryHashStoreContents::RegisterProfilePrefs(
- user_prefs::PrefRegistrySyncable* registry) {
- registry->RegisterDictionaryPref(kPreferenceMACs);
- registry->RegisterStringPref(kSuperMACPref, std::string());
-}
-
-std::string DictionaryHashStoreContents::hash_store_id() const {
- return "";
-}
-
-void DictionaryHashStoreContents::Reset() {
- storage_->Remove(kPreferenceMACs, NULL);
-}
-
-bool DictionaryHashStoreContents::IsInitialized() const {
- return storage_->GetDictionary(kPreferenceMACs, NULL);
-}
-
-const base::DictionaryValue* DictionaryHashStoreContents::GetContents() const {
- const base::DictionaryValue* mac_dictionary = NULL;
- storage_->GetDictionary(kPreferenceMACs, &mac_dictionary);
- return mac_dictionary;
-}
-
-scoped_ptr<HashStoreContents::MutableDictionary>
-DictionaryHashStoreContents::GetMutableContents() {
- return scoped_ptr<MutableDictionary>(
- new MutablePreferenceMacDictionary(storage_));
-}
-
-std::string DictionaryHashStoreContents::GetSuperMac() const {
- std::string super_mac_string;
- storage_->GetString(kSuperMACPref, &super_mac_string);
- return super_mac_string;
-}
-
-void DictionaryHashStoreContents::SetSuperMac(const std::string& super_mac) {
- storage_->SetString(kSuperMACPref, super_mac);
-}
« no previous file with comments | « chrome/browser/prefs/tracked/dictionary_hash_store_contents.h ('k') | chrome/browser/prefs/tracked/hash_store_contents.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698