OLD | NEW |
1 // Copyright (c) 2012 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/browser/speech/google_one_shot_remote_engine.h" | 5 #include "content/browser/speech/google_one_shot_remote_engine.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 } | 114 } |
115 DCHECK(hypothesis); | 115 DCHECK(hypothesis); |
116 if (!hypothesis->IsType(base::Value::TYPE_DICTIONARY)) { | 116 if (!hypothesis->IsType(base::Value::TYPE_DICTIONARY)) { |
117 LOG(WARNING) << "ParseServerResponse: Unexpected value type " | 117 LOG(WARNING) << "ParseServerResponse: Unexpected value type " |
118 << hypothesis->GetType(); | 118 << hypothesis->GetType(); |
119 break; | 119 break; |
120 } | 120 } |
121 | 121 |
122 const base::DictionaryValue* hypothesis_value = | 122 const base::DictionaryValue* hypothesis_value = |
123 static_cast<const base::DictionaryValue*>(hypothesis); | 123 static_cast<const base::DictionaryValue*>(hypothesis); |
124 string16 utterance; | 124 base::string16 utterance; |
125 | 125 |
126 if (!hypothesis_value->GetString(kUtteranceString, &utterance)) { | 126 if (!hypothesis_value->GetString(kUtteranceString, &utterance)) { |
127 LOG(WARNING) << "ParseServerResponse: Missing utterance value."; | 127 LOG(WARNING) << "ParseServerResponse: Missing utterance value."; |
128 break; | 128 break; |
129 } | 129 } |
130 | 130 |
131 // It is not an error if the 'confidence' field is missing. | 131 // It is not an error if the 'confidence' field is missing. |
132 double confidence = 0.0; | 132 double confidence = 0.0; |
133 hypothesis_value->GetDouble(kConfidenceString, &confidence); | 133 hypothesis_value->GetDouble(kConfidenceString, &confidence); |
134 result->hypotheses.push_back(SpeechRecognitionHypothesis(utterance, | 134 result->hypotheses.push_back(SpeechRecognitionHypothesis(utterance, |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 | 286 |
287 bool GoogleOneShotRemoteEngine::IsRecognitionPending() const { | 287 bool GoogleOneShotRemoteEngine::IsRecognitionPending() const { |
288 return url_fetcher_ != NULL; | 288 return url_fetcher_ != NULL; |
289 } | 289 } |
290 | 290 |
291 int GoogleOneShotRemoteEngine::GetDesiredAudioChunkDurationMs() const { | 291 int GoogleOneShotRemoteEngine::GetDesiredAudioChunkDurationMs() const { |
292 return kAudioPacketIntervalMs; | 292 return kAudioPacketIntervalMs; |
293 } | 293 } |
294 | 294 |
295 } // namespace content | 295 } // namespace content |
OLD | NEW |