OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |