| 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/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/string16.h" | 9 #include "base/string16.h" |
| 10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 | 297 |
| 298 void CoreOptionsHandler::HandleSetStringPref(const ListValue* args) { | 298 void CoreOptionsHandler::HandleSetStringPref(const ListValue* args) { |
| 299 HandleSetPref(args, Value::TYPE_STRING); | 299 HandleSetPref(args, Value::TYPE_STRING); |
| 300 } | 300 } |
| 301 | 301 |
| 302 void CoreOptionsHandler::HandleSetListPref(const ListValue* args) { | 302 void CoreOptionsHandler::HandleSetListPref(const ListValue* args) { |
| 303 HandleSetPref(args, Value::TYPE_LIST); | 303 HandleSetPref(args, Value::TYPE_LIST); |
| 304 } | 304 } |
| 305 | 305 |
| 306 void CoreOptionsHandler::HandleSetPref(const ListValue* args, | 306 void CoreOptionsHandler::HandleSetPref(const ListValue* args, |
| 307 Value::ValueType type) { | 307 base::Value::Type type) { |
| 308 DCHECK_GT(static_cast<int>(args->GetSize()), 1); | 308 DCHECK_GT(static_cast<int>(args->GetSize()), 1); |
| 309 | 309 |
| 310 std::string pref_name; | 310 std::string pref_name; |
| 311 if (!args->GetString(0, &pref_name)) | 311 if (!args->GetString(0, &pref_name)) |
| 312 return; | 312 return; |
| 313 | 313 |
| 314 Value* value; | 314 Value* value; |
| 315 if (!args->Get(1, &value)) | 315 if (!args->Get(1, &value)) |
| 316 return; | 316 return; |
| 317 | 317 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 const std::wstring& callback_function = iter->second; | 391 const std::wstring& callback_function = iter->second; |
| 392 ListValue result_value; | 392 ListValue result_value; |
| 393 result_value.Append(Value::CreateStringValue(pref_name->c_str())); | 393 result_value.Append(Value::CreateStringValue(pref_name->c_str())); |
| 394 | 394 |
| 395 result_value.Append(CreateValueForPref(pref)); | 395 result_value.Append(CreateValueForPref(pref)); |
| 396 | 396 |
| 397 web_ui_->CallJavascriptFunction(WideToASCII(callback_function), | 397 web_ui_->CallJavascriptFunction(WideToASCII(callback_function), |
| 398 result_value); | 398 result_value); |
| 399 } | 399 } |
| 400 } | 400 } |
| OLD | NEW |