| 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/options2/core_options_handler2.h" | 5 #include "chrome/browser/ui/webui/options2/core_options_handler2.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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 case base::Value::TYPE_DOUBLE: | 203 case base::Value::TYPE_DOUBLE: |
| 204 case base::Value::TYPE_STRING: | 204 case base::Value::TYPE_STRING: |
| 205 pref_service->Set(pref_name.c_str(), *value); | 205 pref_service->Set(pref_name.c_str(), *value); |
| 206 break; | 206 break; |
| 207 | 207 |
| 208 default: | 208 default: |
| 209 NOTREACHED(); | 209 NOTREACHED(); |
| 210 return; | 210 return; |
| 211 } | 211 } |
| 212 | 212 |
| 213 pref_service->ScheduleSavePersistentPrefs(); | |
| 214 | |
| 215 ProcessUserMetric(value, metric); | 213 ProcessUserMetric(value, metric); |
| 216 } | 214 } |
| 217 | 215 |
| 218 void CoreOptionsHandler::ClearPref(const std::string& pref_name, | 216 void CoreOptionsHandler::ClearPref(const std::string& pref_name, |
| 219 const std::string& metric) { | 217 const std::string& metric) { |
| 220 PrefService* pref_service = Profile::FromWebUI(web_ui_)->GetPrefs(); | 218 PrefService* pref_service = Profile::FromWebUI(web_ui_)->GetPrefs(); |
| 221 pref_service->ClearPref(pref_name.c_str()); | 219 pref_service->ClearPref(pref_name.c_str()); |
| 222 pref_service->ScheduleSavePersistentPrefs(); | |
| 223 | 220 |
| 224 if (!metric.empty()) | 221 if (!metric.empty()) |
| 225 content::RecordComputedAction(metric); | 222 content::RecordComputedAction(metric); |
| 226 } | 223 } |
| 227 | 224 |
| 228 void CoreOptionsHandler::ProcessUserMetric(const base::Value* value, | 225 void CoreOptionsHandler::ProcessUserMetric(const base::Value* value, |
| 229 const std::string& metric) { | 226 const std::string& metric) { |
| 230 if (metric.empty()) | 227 if (metric.empty()) |
| 231 return; | 228 return; |
| 232 | 229 |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 | 460 |
| 464 void CoreOptionsHandler::UpdateClearPluginLSOData() { | 461 void CoreOptionsHandler::UpdateClearPluginLSOData() { |
| 465 scoped_ptr<base::Value> enabled( | 462 scoped_ptr<base::Value> enabled( |
| 466 base::Value::CreateBooleanValue( | 463 base::Value::CreateBooleanValue( |
| 467 clear_plugin_lso_data_enabled_.GetValue())); | 464 clear_plugin_lso_data_enabled_.GetValue())); |
| 468 web_ui_->CallJavascriptFunction( | 465 web_ui_->CallJavascriptFunction( |
| 469 "OptionsPage.setClearPluginLSODataEnabled", *enabled); | 466 "OptionsPage.setClearPluginLSODataEnabled", *enabled); |
| 470 } | 467 } |
| 471 | 468 |
| 472 } // namespace options2 | 469 } // namespace options2 |
| OLD | NEW |