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 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 } | 362 } |
363 | 363 |
364 base::Value* CoreOptionsHandler::CreateValueForPref( | 364 base::Value* CoreOptionsHandler::CreateValueForPref( |
365 const std::string& pref_name, | 365 const std::string& pref_name, |
366 const std::string& controlling_pref_name) { | 366 const std::string& controlling_pref_name) { |
367 const PrefService* pref_service = FindServiceForPref(pref_name.c_str()); | 367 const PrefService* pref_service = FindServiceForPref(pref_name.c_str()); |
368 const PrefService::Preference* pref = | 368 const PrefService::Preference* pref = |
369 pref_service->FindPreference(pref_name.c_str()); | 369 pref_service->FindPreference(pref_name.c_str()); |
370 if (!pref) { | 370 if (!pref) { |
371 NOTREACHED(); | 371 NOTREACHED(); |
372 return base::Value::CreateNullValue(); | 372 return base::Value::CreateNullValue().release(); |
373 } | 373 } |
374 const PrefService::Preference* controlling_pref = | 374 const PrefService::Preference* controlling_pref = |
375 pref_service->FindPreference(controlling_pref_name.c_str()); | 375 pref_service->FindPreference(controlling_pref_name.c_str()); |
376 if (!controlling_pref) | 376 if (!controlling_pref) |
377 controlling_pref = pref; | 377 controlling_pref = pref; |
378 | 378 |
379 base::DictionaryValue* dict = new base::DictionaryValue; | 379 base::DictionaryValue* dict = new base::DictionaryValue; |
380 dict->Set("value", pref->GetValue()->DeepCopy()); | 380 dict->Set("value", pref->GetValue()->DeepCopy()); |
381 if (controlling_pref->IsManaged()) { | 381 if (controlling_pref->IsManaged()) { |
382 dict->SetString("controlledBy", "policy"); | 382 dict->SetString("controlledBy", "policy"); |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 plugin_status_pref_setter_.IsPepperFlashSettingsEnabled()); | 653 plugin_status_pref_setter_.IsPepperFlashSettingsEnabled()); |
654 web_ui()->CallJavascriptFunction( | 654 web_ui()->CallJavascriptFunction( |
655 "OptionsPage.setPepperFlashSettingsEnabled", enabled); | 655 "OptionsPage.setPepperFlashSettingsEnabled", enabled); |
656 } | 656 } |
657 | 657 |
658 bool CoreOptionsHandler::IsUserUnsupervised(const base::Value* to_value) { | 658 bool CoreOptionsHandler::IsUserUnsupervised(const base::Value* to_value) { |
659 return !Profile::FromWebUI(web_ui())->IsSupervised(); | 659 return !Profile::FromWebUI(web_ui())->IsSupervised(); |
660 } | 660 } |
661 | 661 |
662 } // namespace options | 662 } // namespace options |
OLD | NEW |