By moving the call to Load() up in SearchProvider::Start(), we are giving a chance...
[chromium-blink-merge.git] / content / browser / webui / web_ui_message_handler.cc
blob1c086e201515992aa2e0adf7239a285326be065e
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
3 // found in the LICENSE file.
5 #include "content/public/browser/web_ui_message_handler.h"
7 #include "base/logging.h"
8 #include "base/values.h"
9 #include "base/string_number_conversions.h"
10 #include "base/utf_string_conversions.h"
11 #include "googleurl/src/gurl.h"
13 namespace content {
15 bool WebUIMessageHandler::ExtractIntegerValue(const ListValue* value,
16 int* out_int) {
17 std::string string_value;
18 if (value->GetString(0, &string_value))
19 return base::StringToInt(string_value, out_int);
20 double double_value;
21 if (value->GetDouble(0, &double_value)) {
22 *out_int = static_cast<int>(double_value);
23 return true;
25 NOTREACHED();
26 return false;
29 bool WebUIMessageHandler::ExtractDoubleValue(const ListValue* value,
30 double* out_value) {
31 std::string string_value;
32 if (value->GetString(0, &string_value))
33 return base::StringToDouble(string_value, out_value);
34 if (value->GetDouble(0, out_value))
35 return true;
36 NOTREACHED();
37 return false;
40 string16 WebUIMessageHandler::ExtractStringValue(const ListValue* value) {
41 string16 string16_value;
42 if (value->GetString(0, &string16_value))
43 return string16_value;
44 NOTREACHED();
45 return string16();
48 } // namespace content