summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions
diff options
context:
space:
mode:
authoryusukes@google.com <yusukes@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-05 17:23:56 +0000
committeryusukes@google.com <yusukes@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-05 17:23:56 +0000
commit05c7da698dc0aa33c4a116dacfcadc90702cf83b (patch)
tree8742dcda690a4420a4d3076c0c4d01f9bc80cf24 /chrome/browser/extensions
parent4bef1e0e520daf9d70f5cefa8d5c9c0679308498 (diff)
downloadchromium_src-05c7da698dc0aa33c4a116dacfcadc90702cf83b.zip
chromium_src-05c7da698dc0aa33c4a116dacfcadc90702cf83b.tar.gz
chromium_src-05c7da698dc0aa33c4a116dacfcadc90702cf83b.tar.bz2
Remove Value::GetAsInteger() calls.
Since r83705, Value::GetAsDouble() can return an integer value as double. We no longer need to call Value::GetAsInteger() explicitly. BUG=None TEST=ran try Review URL: http://codereview.chromium.org/6901084 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@84263 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions')
-rw-r--r--chrome/browser/extensions/extension_history_api.cc8
-rw-r--r--chrome/browser/extensions/extension_tts_api.cc6
-rw-r--r--chrome/browser/extensions/extension_tts_api_util.cc24
-rw-r--r--chrome/browser/extensions/extension_tts_api_util.h6
4 files changed, 7 insertions, 37 deletions
diff --git a/chrome/browser/extensions/extension_history_api.cc b/chrome/browser/extensions/extension_history_api.cc
index 49929bd..9ead422 100644
--- a/chrome/browser/extensions/extension_history_api.cc
+++ b/chrome/browser/extensions/extension_history_api.cc
@@ -176,12 +176,8 @@ bool HistoryFunction::GetUrlFromValue(Value* value, GURL* url) {
bool HistoryFunction::GetTimeFromValue(Value* value, base::Time* time) {
double ms_from_epoch = 0.0;
- if (!value->GetAsDouble(&ms_from_epoch)) {
- int ms_from_epoch_as_int = 0;
- if (!value->GetAsInteger(&ms_from_epoch_as_int))
- return false;
- ms_from_epoch = static_cast<double>(ms_from_epoch_as_int);
- }
+ if (!value->GetAsDouble(&ms_from_epoch))
+ return false;
// The history service has seconds resolution, while javascript Date() has
// milliseconds resolution.
double seconds_from_epoch = ms_from_epoch / 1000.0;
diff --git a/chrome/browser/extensions/extension_tts_api.cc b/chrome/browser/extensions/extension_tts_api.cc
index 997f080..4781751 100644
--- a/chrome/browser/extensions/extension_tts_api.cc
+++ b/chrome/browser/extensions/extension_tts_api.cc
@@ -79,17 +79,17 @@ Utterance::Utterance(Profile* profile,
if (options->HasKey(util::kGenderKey))
options->GetString(util::kGenderKey, &gender_);
- if (util::ReadNumberByKey(options, util::kRateKey, &rate_)) {
+ if (options->GetDouble(util::kRateKey, &rate_)) {
if (!base::IsFinite(rate_) || rate_ < 0.0 || rate_ > 1.0)
rate_ = -1.0;
}
- if (util::ReadNumberByKey(options, util::kPitchKey, &pitch_)) {
+ if (options->GetDouble(util::kPitchKey, &pitch_)) {
if (!base::IsFinite(pitch_) || pitch_ < 0.0 || pitch_ > 1.0)
pitch_ = -1.0;
}
- if (util::ReadNumberByKey(options, util::kVolumeKey, &volume_)) {
+ if (options->GetDouble(util::kVolumeKey, &volume_)) {
if (!base::IsFinite(volume_) || volume_ < 0.0 || volume_ > 1.0)
volume_ = -1.0;
}
diff --git a/chrome/browser/extensions/extension_tts_api_util.cc b/chrome/browser/extensions/extension_tts_api_util.cc
index b630387..8884966 100644
--- a/chrome/browser/extensions/extension_tts_api_util.cc
+++ b/chrome/browser/extensions/extension_tts_api_util.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -14,26 +14,4 @@ const char kPitchKey[] = "pitch";
const char kVolumeKey[] = "volume";
const char kEnqueueKey[] = "enqueue";
-// Static.
-bool ReadNumberByKey(DictionaryValue* dict,
- const char* key,
- double* ret_value) {
- Value* value;
- if (!dict->Get(key, &value))
- return false;
-
- if (value->IsType(Value::TYPE_INTEGER)) {
- int int_value;
- if (!dict->GetInteger(key, &int_value))
- return false;
- *ret_value = int_value;
- } else if (value->IsType(Value::TYPE_DOUBLE)) {
- if (!dict->GetDouble(key, ret_value))
- return false;
- } else {
- return false;
- }
- return true;
-}
-
} // namespace extension_tts_api_util.
diff --git a/chrome/browser/extensions/extension_tts_api_util.h b/chrome/browser/extensions/extension_tts_api_util.h
index 9d13e75..4ca782c 100644
--- a/chrome/browser/extensions/extension_tts_api_util.h
+++ b/chrome/browser/extensions/extension_tts_api_util.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -19,9 +19,5 @@ extern const char kPitchKey[];
extern const char kVolumeKey[];
extern const char kEnqueueKey[];
-bool ReadNumberByKey(DictionaryValue* dict,
- const char* key,
- double* ret_value);
-
} // namespace extension_tts_api_util.
#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TTS_API_UTIL_H_