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

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: 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/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..dc1e59937279109c2a334cc957329135ec37c066 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
@@ -43,9 +43,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 =
- static_cast<const base::ListValue*>(pref_value);
+base::Value* CreateUsersWhitelist(base::Value *pref_value) {
+ scoped_ptr<base::ListValue> list_value(
+ static_cast<base::ListValue*>(pref_value));
Mattias Nissler (ping if slow) 2011/12/02 12:13:37 No need to pass a copy into CreateUsersWhitelist?
pastarmovj 2011/12/02 14:43:38 Done.
base::ListValue *user_list = new base::ListValue();
const User& self = UserManager::Get()->logged_in_user();
@@ -118,20 +118,20 @@ 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();
// Lists don't get the standard pref decoration.
if (pref_value->GetType() == base::Value::TYPE_LIST) {
if (pref_name == kAccountsPrefUsers)
- return CreateUsersWhitelist(pref_value);
+ return CreateUsersWhitelist(pref_value->DeepCopy());
+ // 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());
}

Powered by Google App Engine
This is Rietveld 408576698