OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 dict->Set("value", pref->GetValue()->DeepCopy()); | 277 dict->Set("value", pref->GetValue()->DeepCopy()); |
278 if (!controlling_pref) // No controlling pref is managing actual pref. | 278 if (!controlling_pref) // No controlling pref is managing actual pref. |
279 controlling_pref = pref; // This means pref is controlling itself. | 279 controlling_pref = pref; // This means pref is controlling itself. |
280 if (controlling_pref->IsManaged()) { | 280 if (controlling_pref->IsManaged()) { |
281 dict->SetString("controlledBy", "policy"); | 281 dict->SetString("controlledBy", "policy"); |
282 } else if (controlling_pref->IsExtensionControlled()) { | 282 } else if (controlling_pref->IsExtensionControlled()) { |
283 dict->SetString("controlledBy", "extension"); | 283 dict->SetString("controlledBy", "extension"); |
284 } else if (controlling_pref->IsRecommended()) { | 284 } else if (controlling_pref->IsRecommended()) { |
285 dict->SetString("controlledBy", "recommended"); | 285 dict->SetString("controlledBy", "recommended"); |
286 } | 286 } |
| 287 const base::Value* recommended_value = |
| 288 controlling_pref->GetRecommendedValue(); |
| 289 if (recommended_value) |
| 290 dict->Set("recommendedValue", recommended_value->DeepCopy()); |
287 dict->SetBoolean("disabled", !controlling_pref->IsUserModifiable()); | 291 dict->SetBoolean("disabled", !controlling_pref->IsUserModifiable()); |
288 return dict; | 292 return dict; |
289 } | 293 } |
290 | 294 |
291 void CoreOptionsHandler::StopObservingPref(const std::string& path) { | 295 void CoreOptionsHandler::StopObservingPref(const std::string& path) { |
292 registrar_.Remove(path.c_str(), this); | 296 registrar_.Remove(path.c_str(), this); |
293 } | 297 } |
294 | 298 |
295 void CoreOptionsHandler::HandleFetchPrefs(const ListValue* args) { | 299 void CoreOptionsHandler::HandleFetchPrefs(const ListValue* args) { |
296 // First param is name of callback function, so, there needs to be at least | 300 // First param is name of callback function, so, there needs to be at least |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 | 478 |
475 void CoreOptionsHandler::UpdatePepperFlashSettingsEnabled() { | 479 void CoreOptionsHandler::UpdatePepperFlashSettingsEnabled() { |
476 scoped_ptr<base::Value> enabled( | 480 scoped_ptr<base::Value> enabled( |
477 base::Value::CreateBooleanValue( | 481 base::Value::CreateBooleanValue( |
478 plugin_status_pref_setter_.IsPepperFlashSettingsEnabled())); | 482 plugin_status_pref_setter_.IsPepperFlashSettingsEnabled())); |
479 web_ui()->CallJavascriptFunction( | 483 web_ui()->CallJavascriptFunction( |
480 "OptionsPage.setPepperFlashSettingsEnabled", *enabled); | 484 "OptionsPage.setPepperFlashSettingsEnabled", *enabled); |
481 } | 485 } |
482 | 486 |
483 } // namespace options | 487 } // namespace options |
OLD | NEW |