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

Side by Side Diff: content/browser/speech/speech_recognition_request.cc

Issue 7753020: Revert recent changes to base::Value (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 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
« no previous file with comments | « chrome/test/webdriver/webdriver_session.cc ('k') | content/renderer/web_ui_bindings.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "content/browser/speech/speech_recognition_request.h" 5 #include "content/browser/speech/speech_recognition_request.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/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 const DictionaryValue* response_object = 53 const DictionaryValue* response_object =
54 static_cast<DictionaryValue*>(response_value.get()); 54 static_cast<DictionaryValue*>(response_value.get());
55 55
56 // Get the hypotheses 56 // Get the hypotheses
57 Value* hypotheses_value = NULL; 57 Value* hypotheses_value = NULL;
58 if (!response_object->Get(kHypothesesString, &hypotheses_value)) { 58 if (!response_object->Get(kHypothesesString, &hypotheses_value)) {
59 VLOG(1) << "ParseServerResponse: Missing hypotheses attribute."; 59 VLOG(1) << "ParseServerResponse: Missing hypotheses attribute.";
60 return false; 60 return false;
61 } 61 }
62 DCHECK(hypotheses_value); 62 DCHECK(hypotheses_value);
63 const ListValue* hypotheses_list = hypotheses_value->AsList(); 63 if (!hypotheses_value->IsType(Value::TYPE_LIST)) {
64 if (!hypotheses_list) {
65 VLOG(1) << "ParseServerResponse: Unexpected hypotheses type " 64 VLOG(1) << "ParseServerResponse: Unexpected hypotheses type "
66 << hypotheses_value->GetType(); 65 << hypotheses_value->GetType();
67 return false; 66 return false;
68 } 67 }
68 const ListValue* hypotheses_list = static_cast<ListValue*>(hypotheses_value);
69 69
70 size_t index = 0; 70 size_t index = 0;
71 for (; index < hypotheses_list->GetSize(); ++index) { 71 for (; index < hypotheses_list->GetSize(); ++index) {
72 Value* hypothesis = NULL; 72 Value* hypothesis = NULL;
73 if (!hypotheses_list->Get(index, &hypothesis)) { 73 if (!hypotheses_list->Get(index, &hypothesis)) {
74 LOG(WARNING) << "ParseServerResponse: Unable to read hypothesis value."; 74 LOG(WARNING) << "ParseServerResponse: Unable to read hypothesis value.";
75 break; 75 break;
76 } 76 }
77 DCHECK(hypothesis); 77 DCHECK(hypothesis);
78 if (!hypothesis->IsType(Value::TYPE_DICTIONARY)) { 78 if (!hypothesis->IsType(Value::TYPE_DICTIONARY)) {
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 SpeechInputResultArray result; 192 SpeechInputResultArray result;
193 if (!error) 193 if (!error)
194 error = !ParseServerResponse(data, &result); 194 error = !ParseServerResponse(data, &result);
195 url_fetcher_.reset(); 195 url_fetcher_.reset();
196 196
197 DVLOG(1) << "SpeechRecognitionRequest: Invoking delegate with result."; 197 DVLOG(1) << "SpeechRecognitionRequest: Invoking delegate with result.";
198 delegate_->SetRecognitionResult(error, result); 198 delegate_->SetRecognitionResult(error, result);
199 } 199 }
200 200
201 } // namespace speech_input 201 } // namespace speech_input
OLDNEW
« no previous file with comments | « chrome/test/webdriver/webdriver_session.cc ('k') | content/renderer/web_ui_bindings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698