| OLD | NEW |
| 1 // Copyright (c) 2011 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 "content/public/browser/web_ui_message_handler.h" | 5 #include "content/public/browser/web_ui_message_handler.h" |
| 6 | 6 |
| 7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| 11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 double double_value; | 47 double double_value; |
| 48 if (value->GetDouble(0, &double_value)) { | 48 if (value->GetDouble(0, &double_value)) { |
| 49 *out_int = static_cast<int>(double_value); | 49 *out_int = static_cast<int>(double_value); |
| 50 return true; | 50 return true; |
| 51 } | 51 } |
| 52 NOTREACHED(); | 52 NOTREACHED(); |
| 53 return false; | 53 return false; |
| 54 } | 54 } |
| 55 | 55 |
| 56 bool WebUIMessageHandler::ExtractDoubleValue(const ListValue* value, | 56 bool WebUIMessageHandler::ExtractDoubleValue(const ListValue* value, |
| 57 double* out_value) { | 57 double* out_value) { |
| 58 std::string string_value; | 58 std::string string_value; |
| 59 if (value->GetString(0, &string_value)) | 59 if (value->GetString(0, &string_value)) |
| 60 return base::StringToDouble(string_value, out_value); | 60 return base::StringToDouble(string_value, out_value); |
| 61 if (value->GetDouble(0, out_value)) |
| 62 return true; |
| 61 NOTREACHED(); | 63 NOTREACHED(); |
| 62 return false; | 64 return false; |
| 63 } | 65 } |
| 64 | 66 |
| 65 string16 WebUIMessageHandler::ExtractStringValue(const ListValue* value) { | 67 string16 WebUIMessageHandler::ExtractStringValue(const ListValue* value) { |
| 66 string16 string16_value; | 68 string16 string16_value; |
| 67 if (value->GetString(0, &string16_value)) | 69 if (value->GetString(0, &string16_value)) |
| 68 return string16_value; | 70 return string16_value; |
| 69 NOTREACHED(); | 71 NOTREACHED(); |
| 70 return string16(); | 72 return string16(); |
| 71 } | 73 } |
| 72 | 74 |
| 73 } // namespace content | 75 } // namespace content |
| OLD | NEW |