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 <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 Loading... |
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 Loading... |
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 } |
OLD | NEW |