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

Unified Diff: chrome/browser/chromeos/login/signed_settings_temp_storage.cc

Issue 8727037: Signed settings refactoring: Proper caching and more tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Next round of comments. All bots meanwhile good and manual testing seems fine as well. Created 9 years, 1 month 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/chromeos/login/signed_settings_temp_storage.cc
diff --git a/chrome/browser/chromeos/login/signed_settings_temp_storage.cc b/chrome/browser/chromeos/login/signed_settings_temp_storage.cc
deleted file mode 100644
index 4435b99011d848d54d8649beb484eccd363ba720..0000000000000000000000000000000000000000
--- a/chrome/browser/chromeos/login/signed_settings_temp_storage.cc
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright (c) 2011 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/chromeos/login/signed_settings_temp_storage.h"
-
-#include "base/values.h"
-#include "chrome/browser/chromeos/login/ownership_service.h"
-#include "chrome/browser/chromeos/login/signed_settings_helper.h"
-#include "chrome/browser/prefs/pref_service.h"
-#include "chrome/browser/prefs/scoped_user_pref_update.h"
-#include "chrome/common/pref_names.h"
-
-using content::BrowserThread;
-
-namespace chromeos {
-
-// static
-void SignedSettingsTempStorage::RegisterPrefs(PrefService* local_state) {
- local_state->RegisterDictionaryPref(prefs::kSignedSettingsTempStorage);
-}
-
-// static
-bool SignedSettingsTempStorage::Store(const std::string& name,
- const base::Value& value,
- PrefService* local_state) {
- if (local_state) {
- DictionaryPrefUpdate temp_storage_update(
- local_state, prefs::kSignedSettingsTempStorage);
- temp_storage_update->SetWithoutPathExpansion(
- name, value.DeepCopy());
- return true;
- }
- return false;
-}
-
-// static
-bool SignedSettingsTempStorage::Retrieve(const std::string& name,
- base::Value** value,
- PrefService* local_state) {
- if (local_state) {
- const DictionaryValue* temp_storage =
- local_state->GetDictionary(prefs::kSignedSettingsTempStorage);
- if (temp_storage && temp_storage->HasKey(name)) {
- temp_storage->GetWithoutPathExpansion(name, value);
- return true;
- }
- }
- return false;
-}
-
-// static
-void SignedSettingsTempStorage::Finalize(PrefService* local_state) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- if (local_state) {
- const DictionaryValue* temp_storage =
- local_state->GetDictionary(prefs::kSignedSettingsTempStorage);
- if (temp_storage) {
- // We've stored some settings in transient storage
- // before owner has been assigned.
- // Now owner is assigned and key is generated and we should persist
- // those settings into signed storage.
- for (DictionaryValue::key_iterator it = temp_storage->begin_keys();
- it != temp_storage->end_keys();
- ++it) {
- base::Value* value = NULL;
- bool get_result = temp_storage->GetWithoutPathExpansion(*it, &value);
- DCHECK(value && get_result);
- if (value)
- SignedSettingsHelper::Get()->StartStorePropertyOp(*it, *value, NULL);
- }
- local_state->ClearPref(prefs::kSignedSettingsTempStorage);
- }
- }
-}
-
-} // namespace chromeos

Powered by Google App Engine
This is Rietveld 408576698