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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 | 199 |
200 void CoreOptionsHandler::ObservePref(const std::string& pref_name) { | 200 void CoreOptionsHandler::ObservePref(const std::string& pref_name) { |
201 if (g_browser_process->local_state()->FindPreference(pref_name.c_str())) | 201 if (g_browser_process->local_state()->FindPreference(pref_name.c_str())) |
202 local_state_registrar_.Add(pref_name.c_str(), this); | 202 local_state_registrar_.Add(pref_name.c_str(), this); |
203 else | 203 else |
204 registrar_.Add(pref_name.c_str(), this); | 204 registrar_.Add(pref_name.c_str(), this); |
205 } | 205 } |
206 | 206 |
207 void CoreOptionsHandler::StopObservingPref(const std::string& pref_name) { | 207 void CoreOptionsHandler::StopObservingPref(const std::string& pref_name) { |
208 if (g_browser_process->local_state()->FindPreference(pref_name.c_str())) | 208 if (g_browser_process->local_state()->FindPreference(pref_name.c_str())) |
209 local_state_registrar_.Remove(pref_name.c_str(), this); | 209 local_state_registrar_.Remove(pref_name.c_str()); |
210 else | 210 else |
211 registrar_.Remove(pref_name.c_str(), this); | 211 registrar_.Remove(pref_name.c_str()); |
212 } | 212 } |
213 | 213 |
214 void CoreOptionsHandler::SetPref(const std::string& pref_name, | 214 void CoreOptionsHandler::SetPref(const std::string& pref_name, |
215 const base::Value* value, | 215 const base::Value* value, |
216 const std::string& metric) { | 216 const std::string& metric) { |
217 PrefService* pref_service = FindServiceForPref(pref_name); | 217 PrefService* pref_service = FindServiceForPref(pref_name); |
218 PrefChangeFilterMap::iterator iter = pref_change_filters_.find(pref_name); | 218 PrefChangeFilterMap::iterator iter = pref_change_filters_.find(pref_name); |
219 if (iter != pref_change_filters_.end()) { | 219 if (iter != pref_change_filters_.end()) { |
220 // Also check if the pref is user modifiable (don't even try to run the | 220 // Also check if the pref is user modifiable (don't even try to run the |
221 // filter function if the user is not allowed to change the pref). | 221 // filter function if the user is not allowed to change the pref). |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 | 531 |
532 void CoreOptionsHandler::UpdatePepperFlashSettingsEnabled() { | 532 void CoreOptionsHandler::UpdatePepperFlashSettingsEnabled() { |
533 scoped_ptr<base::Value> enabled( | 533 scoped_ptr<base::Value> enabled( |
534 base::Value::CreateBooleanValue( | 534 base::Value::CreateBooleanValue( |
535 plugin_status_pref_setter_.IsPepperFlashSettingsEnabled())); | 535 plugin_status_pref_setter_.IsPepperFlashSettingsEnabled())); |
536 web_ui()->CallJavascriptFunction( | 536 web_ui()->CallJavascriptFunction( |
537 "OptionsPage.setPepperFlashSettingsEnabled", *enabled); | 537 "OptionsPage.setPepperFlashSettingsEnabled", *enabled); |
538 } | 538 } |
539 | 539 |
540 } // namespace options | 540 } // namespace options |
OLD | NEW |