Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Side by Side Diff: chrome/browser/extensions/extension_tts_api.cc

Issue 6901084: Use new APIs in base/values.h: Value::GetAsNumber and DictionaryValue::GetNumber. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase, 2010->2011 Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <string> 5 #include <string>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/float_util.h" 8 #include "base/float_util.h"
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 72
73 if (options->HasKey(util::kVoiceNameKey)) 73 if (options->HasKey(util::kVoiceNameKey))
74 options->GetString(util::kVoiceNameKey, &voice_name_); 74 options->GetString(util::kVoiceNameKey, &voice_name_);
75 75
76 if (options->HasKey(util::kLocaleKey)) 76 if (options->HasKey(util::kLocaleKey))
77 options->GetString(util::kLocaleKey, &locale_); 77 options->GetString(util::kLocaleKey, &locale_);
78 78
79 if (options->HasKey(util::kGenderKey)) 79 if (options->HasKey(util::kGenderKey))
80 options->GetString(util::kGenderKey, &gender_); 80 options->GetString(util::kGenderKey, &gender_);
81 81
82 if (util::ReadNumberByKey(options, util::kRateKey, &rate_)) { 82 if (options->GetDouble(util::kRateKey, &rate_)) {
83 if (!base::IsFinite(rate_) || rate_ < 0.0 || rate_ > 1.0) 83 if (!base::IsFinite(rate_) || rate_ < 0.0 || rate_ > 1.0)
84 rate_ = -1.0; 84 rate_ = -1.0;
85 } 85 }
86 86
87 if (util::ReadNumberByKey(options, util::kPitchKey, &pitch_)) { 87 if (options->GetDouble(util::kPitchKey, &pitch_)) {
88 if (!base::IsFinite(pitch_) || pitch_ < 0.0 || pitch_ > 1.0) 88 if (!base::IsFinite(pitch_) || pitch_ < 0.0 || pitch_ > 1.0)
89 pitch_ = -1.0; 89 pitch_ = -1.0;
90 } 90 }
91 91
92 if (util::ReadNumberByKey(options, util::kVolumeKey, &volume_)) { 92 if (options->GetDouble(util::kVolumeKey, &volume_)) {
93 if (!base::IsFinite(volume_) || volume_ < 0.0 || volume_ > 1.0) 93 if (!base::IsFinite(volume_) || volume_ < 0.0 || volume_ > 1.0)
94 volume_ = -1.0; 94 volume_ = -1.0;
95 } 95 }
96 96
97 if (options->HasKey(util::kEnqueueKey)) 97 if (options->HasKey(util::kEnqueueKey))
98 options->GetBoolean(util::kEnqueueKey, &can_enqueue_); 98 options->GetBoolean(util::kEnqueueKey, &can_enqueue_);
99 } 99 }
100 100
101 Utterance::~Utterance() { 101 Utterance::~Utterance() {
102 DCHECK_EQ(completion_task_, static_cast<Task *>(NULL)); 102 DCHECK_EQ(completion_task_, static_cast<Task *>(NULL));
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 int request_id; 377 int request_id;
378 std::string error_message; 378 std::string error_message;
379 EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &request_id)); 379 EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &request_id));
380 if (args_->GetSize() >= 2) 380 if (args_->GetSize() >= 2)
381 EXTENSION_FUNCTION_VALIDATE(args_->GetString(1, &error_message)); 381 EXTENSION_FUNCTION_VALIDATE(args_->GetString(1, &error_message));
382 ExtensionTtsController::GetInstance()->OnSpeechFinished( 382 ExtensionTtsController::GetInstance()->OnSpeechFinished(
383 request_id, error_message); 383 request_id, error_message);
384 384
385 return true; 385 return true;
386 } 386 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_history_api.cc ('k') | chrome/browser/extensions/extension_tts_api_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698