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

Side by Side Diff: chrome/browser/chromeos/user_cros_settings_provider.cc

Issue 6905044: Refactor preference syncing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Self review Created 9 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/chromeos/user_cros_settings_provider.h" 5 #include "chrome/browser/chromeos/user_cros_settings_provider.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 9
10 #include "base/hash_tables.h" 10 #include "base/hash_tables.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 69
70 bool IsControlledListSetting(const std::string& pref_path) { 70 bool IsControlledListSetting(const std::string& pref_path) {
71 return std::find(kListSettings, 71 return std::find(kListSettings,
72 kListSettings + arraysize(kListSettings), 72 kListSettings + arraysize(kListSettings),
73 pref_path) != 73 pref_path) !=
74 kListSettings + arraysize(kListSettings); 74 kListSettings + arraysize(kListSettings);
75 } 75 }
76 76
77 void RegisterSetting(PrefService* local_state, const std::string& pref_path) { 77 void RegisterSetting(PrefService* local_state, const std::string& pref_path) {
78 local_state->RegisterBooleanPref((pref_path + kTrustedSuffix).c_str(), 78 local_state->RegisterBooleanPref((pref_path + kTrustedSuffix).c_str(),
79 false); 79 false,
80 false /* don't sync pref */);
80 if (IsControlledBooleanSetting(pref_path)) { 81 if (IsControlledBooleanSetting(pref_path)) {
81 if (pref_path == kSignedDataRoamingEnabled) 82 if (pref_path == kSignedDataRoamingEnabled)
82 local_state->RegisterBooleanPref(pref_path.c_str(), false); 83 local_state->RegisterBooleanPref(pref_path.c_str(),
84 false,
85 false /* don't sync pref */);
83 else 86 else
84 local_state->RegisterBooleanPref(pref_path.c_str(), true); 87 local_state->RegisterBooleanPref(pref_path.c_str(),
88 true,
89 false /* don't sync pref */);
85 } else if (IsControlledStringSetting(pref_path)) { 90 } else if (IsControlledStringSetting(pref_path)) {
86 local_state->RegisterStringPref(pref_path.c_str(), ""); 91 local_state->RegisterStringPref(pref_path.c_str(),
92 "",
93 false /* don't sync pref */);
87 } else { 94 } else {
88 DCHECK(IsControlledListSetting(pref_path)); 95 DCHECK(IsControlledListSetting(pref_path));
89 local_state->RegisterListPref(pref_path.c_str()); 96 local_state->RegisterListPref(pref_path.c_str(),
97 false /* don't sync pref */);
90 } 98 }
91 } 99 }
92 100
93 // Create a settings boolean value with "managed" and "disabled" property. 101 // Create a settings boolean value with "managed" and "disabled" property.
94 // "managed" property is true if the setting is managed by administrator. 102 // "managed" property is true if the setting is managed by administrator.
95 // "disabled" property is true if the UI for the setting should be disabled. 103 // "disabled" property is true if the UI for the setting should be disabled.
96 Value* CreateSettingsBooleanValue(bool value, bool managed, bool disabled) { 104 Value* CreateSettingsBooleanValue(bool value, bool managed, bool disabled) {
97 DictionaryValue* dict = new DictionaryValue; 105 DictionaryValue* dict = new DictionaryValue;
98 dict->Set("value", Value::CreateBooleanValue(value)); 106 dict->Set("value", Value::CreateBooleanValue(value));
99 dict->Set("managed", Value::CreateBooleanValue(managed)); 107 dict->Set("managed", Value::CreateBooleanValue(managed));
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 if (cached_whitelist_update->Remove(email_value) != -1) 566 if (cached_whitelist_update->Remove(email_value) != -1)
559 prefs->ScheduleSavePersistentPrefs(); 567 prefs->ScheduleSavePersistentPrefs();
560 } 568 }
561 569
562 // static 570 // static
563 void UserCrosSettingsProvider::UpdateCachedOwner(const std::string& email) { 571 void UserCrosSettingsProvider::UpdateCachedOwner(const std::string& email) {
564 UpdateCacheString(kDeviceOwner, email, USE_VALUE_SUPPLIED); 572 UpdateCacheString(kDeviceOwner, email, USE_VALUE_SUPPLIED);
565 } 573 }
566 574
567 } // namespace chromeos 575 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698