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

Side by Side Diff: chrome/browser/ui/webui/options/core_options_handler.cc

Issue 8896023: Fixed the value of "controlledBy" for preferences when they're set by the user. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/prefs/pref_value_store_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/ui/webui/options/core_options_handler.h" 5 #include "chrome/browser/ui/webui/options/core_options_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 const PrefService::Preference* pref, 265 const PrefService::Preference* pref,
266 const PrefService::Preference* controlling_pref) { 266 const PrefService::Preference* controlling_pref) {
267 DictionaryValue* dict = new DictionaryValue; 267 DictionaryValue* dict = new DictionaryValue;
268 dict->Set("value", pref->GetValue()->DeepCopy()); 268 dict->Set("value", pref->GetValue()->DeepCopy());
269 if (!controlling_pref) // No controlling pref is managing actual pref. 269 if (!controlling_pref) // No controlling pref is managing actual pref.
270 controlling_pref = pref; // This means pref is controlling itself. 270 controlling_pref = pref; // This means pref is controlling itself.
271 if (controlling_pref->IsManaged()) { 271 if (controlling_pref->IsManaged()) {
272 dict->SetString("controlledBy", "policy"); 272 dict->SetString("controlledBy", "policy");
273 } else if (controlling_pref->IsExtensionControlled()) { 273 } else if (controlling_pref->IsExtensionControlled()) {
274 dict->SetString("controlledBy", "extension"); 274 dict->SetString("controlledBy", "extension");
275 } else if (controlling_pref->IsUserModifiable() && 275 } else if (controlling_pref->IsRecommended()) {
276 !controlling_pref->IsDefaultValue()) {
277 dict->SetString("controlledBy", "recommended"); 276 dict->SetString("controlledBy", "recommended");
278 } 277 }
279 dict->SetBoolean("disabled", !controlling_pref->IsUserModifiable()); 278 dict->SetBoolean("disabled", !controlling_pref->IsUserModifiable());
280 return dict; 279 return dict;
281 } 280 }
282 281
283 void CoreOptionsHandler::StopObservingPref(const std::string& path) { 282 void CoreOptionsHandler::StopObservingPref(const std::string& path) {
284 registrar_.Remove(path.c_str(), this); 283 registrar_.Remove(path.c_str(), this);
285 } 284 }
286 285
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 UserMetrics::RecordComputedAction(metric); 455 UserMetrics::RecordComputedAction(metric);
457 } 456 }
458 457
459 void CoreOptionsHandler::UpdateClearPluginLSOData() { 458 void CoreOptionsHandler::UpdateClearPluginLSOData() {
460 scoped_ptr<base::Value> enabled( 459 scoped_ptr<base::Value> enabled(
461 base::Value::CreateBooleanValue( 460 base::Value::CreateBooleanValue(
462 clear_plugin_lso_data_enabled_.GetValue())); 461 clear_plugin_lso_data_enabled_.GetValue()));
463 web_ui_->CallJavascriptFunction( 462 web_ui_->CallJavascriptFunction(
464 "OptionsPage.setClearPluginLSODataEnabled", *enabled); 463 "OptionsPage.setClearPluginLSODataEnabled", *enabled);
465 } 464 }
OLDNEW
« no previous file with comments | « chrome/browser/prefs/pref_value_store_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698