| 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 "content/browser/webui/web_ui.h" | 5 #include "content/browser/webui/web_ui.h" |
| 6 | 6 |
| 7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
| 8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 } | 217 } |
| 218 } | 218 } |
| 219 dictionary->SetString("title", title_to_set); | 219 dictionary->SetString("title", title_to_set); |
| 220 } | 220 } |
| 221 | 221 |
| 222 bool WebUIMessageHandler::ExtractIntegerValue(const ListValue* value, | 222 bool WebUIMessageHandler::ExtractIntegerValue(const ListValue* value, |
| 223 int* out_int) { | 223 int* out_int) { |
| 224 std::string string_value; | 224 std::string string_value; |
| 225 if (value->GetString(0, &string_value)) | 225 if (value->GetString(0, &string_value)) |
| 226 return base::StringToInt(string_value, out_int); | 226 return base::StringToInt(string_value, out_int); |
| 227 double double_value; |
| 228 if (value->GetDouble(0, &double_value)) { |
| 229 *out_int = static_cast<int>(double_value); |
| 230 return true; |
| 231 } |
| 227 NOTREACHED(); | 232 NOTREACHED(); |
| 228 return false; | 233 return false; |
| 229 } | 234 } |
| 230 | 235 |
| 231 bool WebUIMessageHandler::ExtractDoubleValue(const ListValue* value, | 236 bool WebUIMessageHandler::ExtractDoubleValue(const ListValue* value, |
| 232 double* out_value) { | 237 double* out_value) { |
| 233 std::string string_value; | 238 std::string string_value; |
| 234 if (value->GetString(0, &string_value)) | 239 if (value->GetString(0, &string_value)) |
| 235 return base::StringToDouble(string_value, out_value); | 240 return base::StringToDouble(string_value, out_value); |
| 236 NOTREACHED(); | 241 NOTREACHED(); |
| 237 return false; | 242 return false; |
| 238 } | 243 } |
| 239 | 244 |
| 240 string16 WebUIMessageHandler::ExtractStringValue(const ListValue* value) { | 245 string16 WebUIMessageHandler::ExtractStringValue(const ListValue* value) { |
| 241 string16 string16_value; | 246 string16 string16_value; |
| 242 if (value->GetString(0, &string16_value)) | 247 if (value->GetString(0, &string16_value)) |
| 243 return string16_value; | 248 return string16_value; |
| 244 NOTREACHED(); | 249 NOTREACHED(); |
| 245 return string16(); | 250 return string16(); |
| 246 } | 251 } |
| OLD | NEW |