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

Unified Diff: chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler.cc

Issue 8727037: Signed settings refactoring: Proper caching and more tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments. Fixed small bugs. Rebased to ToT. Created 9 years 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/ui/webui/options/chromeos/core_chromeos_options_handler.cc
diff --git a/chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler.cc b/chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler.cc
index 5a8807e19c8de134932e5ff96edee6c850504d8f..7beb5ae3860193433252db2dec39125d7d408309 100644
--- a/chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler.cc
+++ b/chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler.cc
@@ -44,9 +44,9 @@ base::Value* CreateSettingsValue(base::Value *value,
// This function decorates the bare list of emails with some more information
// needed by the UI to properly display the Accounts page.
base::Value* CreateUsersWhitelist(const base::Value *pref_value) {
- const base::ListValue *list_value =
+ const base::ListValue* list_value =
static_cast<const base::ListValue*>(pref_value);
- base::ListValue *user_list = new base::ListValue();
+ base::ListValue* user_list = new base::ListValue();
const User& self = UserManager::Get()->logged_in_user();
bool is_owner = UserManager::Get()->current_user_is_owner();
@@ -118,8 +118,7 @@ base::Value* CoreChromeOSOptionsHandler::FetchPref(
return ::CoreOptionsHandler::FetchPref(pref_name);
}
- const base::Value* pref_value =
- CrosSettings::Get()->GetPref(pref_name);
+ const base::Value* pref_value = CrosSettings::Get()->GetPref(pref_name);
if (!pref_value)
return base::Value::CreateNullValue();
@@ -127,11 +126,12 @@ base::Value* CoreChromeOSOptionsHandler::FetchPref(
if (pref_value->GetType() == base::Value::TYPE_LIST) {
if (pref_name == kAccountsPrefUsers)
return CreateUsersWhitelist(pref_value);
+ // Return a copy because the UI will take ownership of this object.
return pref_value->DeepCopy();
}
// All other prefs are decorated the same way.
return CreateSettingsValue(
- pref_value->DeepCopy(),
+ pref_value->DeepCopy(), // The copy will be owned by the dictionary.
g_browser_process->browser_policy_connector()->IsEnterpriseManaged(),
!UserManager::Get()->current_user_is_owner());
}
@@ -204,7 +204,7 @@ void CoreChromeOSOptionsHandler::NotifySettingsChanged(
const std::string* setting_name) {
DCHECK(web_ui_);
DCHECK(CrosSettings::Get()->IsCrosSettings(*setting_name));
- const base::Value* value = CrosSettings::Get()->GetPref(*setting_name);
+ const base::Value* value = FetchPref(*setting_name);
if (!value) {
NOTREACHED();
return;

Powered by Google App Engine
This is Rietveld 408576698