Chromium Code Reviews| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 85 Profile* profile = Profile::FromWebUI(web_ui()); | 85 Profile* profile = Profile::FromWebUI(web_ui()); |
| 86 | 86 |
| 87 plugin_status_pref_setter_.Init( | 87 plugin_status_pref_setter_.Init( |
| 88 profile, | 88 profile, |
| 89 base::Bind(&CoreOptionsHandler::OnPreferenceChanged, | 89 base::Bind(&CoreOptionsHandler::OnPreferenceChanged, |
| 90 base::Unretained(this), | 90 base::Unretained(this), |
| 91 profile->GetPrefs())); | 91 profile->GetPrefs())); |
| 92 | 92 |
| 93 pref_change_filters_[prefs::kMetricsReportingEnabled] = | 93 pref_change_filters_[prefs::kMetricsReportingEnabled] = |
| 94 base::Bind(&AllowMetricsReportingChange); | 94 base::Bind(&AllowMetricsReportingChange); |
| 95 pref_change_filters_[prefs::kBrowserGuestModeEnabled] = | |
| 96 base::Bind(&CoreOptionsHandler::AllowedByUnsupervisedUserOnly, | |
| 97 base::Unretained(this)); | |
| 98 pref_change_filters_[prefs::kBrowserAddPersonEnabled] = | |
| 99 base::Bind(&CoreOptionsHandler::AllowedByUnsupervisedUserOnly, | |
| 100 base::Unretained(this)); | |
| 95 } | 101 } |
| 96 | 102 |
| 97 void CoreOptionsHandler::InitializePage() { | 103 void CoreOptionsHandler::InitializePage() { |
| 98 UpdateClearPluginLSOData(); | 104 UpdateClearPluginLSOData(); |
| 99 UpdatePepperFlashSettingsEnabled(); | 105 UpdatePepperFlashSettingsEnabled(); |
| 100 } | 106 } |
| 101 | 107 |
| 102 void CoreOptionsHandler::GetLocalizedValues( | 108 void CoreOptionsHandler::GetLocalizedValues( |
| 103 base::DictionaryValue* localized_strings) { | 109 base::DictionaryValue* localized_strings) { |
| 104 GetStaticLocalizedValues(localized_strings); | 110 GetStaticLocalizedValues(localized_strings); |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 650 "OptionsPage.setClearPluginLSODataEnabled", enabled); | 656 "OptionsPage.setClearPluginLSODataEnabled", enabled); |
| 651 } | 657 } |
| 652 | 658 |
| 653 void CoreOptionsHandler::UpdatePepperFlashSettingsEnabled() { | 659 void CoreOptionsHandler::UpdatePepperFlashSettingsEnabled() { |
| 654 base::FundamentalValue enabled( | 660 base::FundamentalValue enabled( |
| 655 plugin_status_pref_setter_.IsPepperFlashSettingsEnabled()); | 661 plugin_status_pref_setter_.IsPepperFlashSettingsEnabled()); |
| 656 web_ui()->CallJavascriptFunction( | 662 web_ui()->CallJavascriptFunction( |
| 657 "OptionsPage.setPepperFlashSettingsEnabled", enabled); | 663 "OptionsPage.setPepperFlashSettingsEnabled", enabled); |
| 658 } | 664 } |
| 659 | 665 |
| 666 bool CoreOptionsHandler::AllowedByUnsupervisedUserOnly( | |
|
Evan Stade
2014/09/02 18:18:18
can you just name this "IsUserUnsupervised"
Mike Lerman
2014/09/04 14:37:08
Done.
| |
| 667 const base::Value* to_value) { | |
| 668 return !Profile::FromWebUI(web_ui())->IsSupervised(); | |
| 669 } | |
| 670 | |
| 660 } // namespace options | 671 } // namespace options |
| OLD | NEW |