| 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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 case base::Value::TYPE_DOUBLE: | 201 case base::Value::TYPE_DOUBLE: |
| 202 case base::Value::TYPE_STRING: | 202 case base::Value::TYPE_STRING: |
| 203 pref_service->Set(pref_name.c_str(), *value); | 203 pref_service->Set(pref_name.c_str(), *value); |
| 204 break; | 204 break; |
| 205 | 205 |
| 206 default: | 206 default: |
| 207 NOTREACHED(); | 207 NOTREACHED(); |
| 208 return; | 208 return; |
| 209 } | 209 } |
| 210 | 210 |
| 211 pref_service->ScheduleSavePersistentPrefs(); | |
| 212 | |
| 213 ProcessUserMetric(value, metric); | 211 ProcessUserMetric(value, metric); |
| 214 } | 212 } |
| 215 | 213 |
| 216 void CoreOptionsHandler::ClearPref(const std::string& pref_name, | 214 void CoreOptionsHandler::ClearPref(const std::string& pref_name, |
| 217 const std::string& metric) { | 215 const std::string& metric) { |
| 218 PrefService* pref_service = Profile::FromWebUI(web_ui_)->GetPrefs(); | 216 PrefService* pref_service = Profile::FromWebUI(web_ui_)->GetPrefs(); |
| 219 pref_service->ClearPref(pref_name.c_str()); | 217 pref_service->ClearPref(pref_name.c_str()); |
| 220 pref_service->ScheduleSavePersistentPrefs(); | |
| 221 | 218 |
| 222 if (!metric.empty()) | 219 if (!metric.empty()) |
| 223 content::RecordComputedAction(metric); | 220 content::RecordComputedAction(metric); |
| 224 } | 221 } |
| 225 | 222 |
| 226 void CoreOptionsHandler::ProcessUserMetric(const base::Value* value, | 223 void CoreOptionsHandler::ProcessUserMetric(const base::Value* value, |
| 227 const std::string& metric) { | 224 const std::string& metric) { |
| 228 if (metric.empty()) | 225 if (metric.empty()) |
| 229 return; | 226 return; |
| 230 | 227 |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 content::RecordComputedAction(metric); | 454 content::RecordComputedAction(metric); |
| 458 } | 455 } |
| 459 | 456 |
| 460 void CoreOptionsHandler::UpdateClearPluginLSOData() { | 457 void CoreOptionsHandler::UpdateClearPluginLSOData() { |
| 461 scoped_ptr<base::Value> enabled( | 458 scoped_ptr<base::Value> enabled( |
| 462 base::Value::CreateBooleanValue( | 459 base::Value::CreateBooleanValue( |
| 463 clear_plugin_lso_data_enabled_.GetValue())); | 460 clear_plugin_lso_data_enabled_.GetValue())); |
| 464 web_ui_->CallJavascriptFunction( | 461 web_ui_->CallJavascriptFunction( |
| 465 "OptionsPage.setClearPluginLSODataEnabled", *enabled); | 462 "OptionsPage.setClearPluginLSODataEnabled", *enabled); |
| 466 } | 463 } |
| OLD | NEW |