OLD | NEW |
1 // Copyright (c) 2010 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 "chrome/browser/speech/speech_recognition_request.h" | 5 #include "chrome/browser/speech/speech_recognition_request.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 url_fetcher_->set_load_flags( | 168 url_fetcher_->set_load_flags( |
169 net::LOAD_DO_NOT_SAVE_COOKIES | net::LOAD_DO_NOT_SEND_COOKIES | | 169 net::LOAD_DO_NOT_SAVE_COOKIES | net::LOAD_DO_NOT_SEND_COOKIES | |
170 net::LOAD_DO_NOT_SEND_AUTH_DATA); | 170 net::LOAD_DO_NOT_SEND_AUTH_DATA); |
171 url_fetcher_->Start(); | 171 url_fetcher_->Start(); |
172 return true; | 172 return true; |
173 } | 173 } |
174 | 174 |
175 void SpeechRecognitionRequest::OnURLFetchComplete( | 175 void SpeechRecognitionRequest::OnURLFetchComplete( |
176 const URLFetcher* source, | 176 const URLFetcher* source, |
177 const GURL& url, | 177 const GURL& url, |
178 const URLRequestStatus& status, | 178 const net::URLRequestStatus& status, |
179 int response_code, | 179 int response_code, |
180 const ResponseCookies& cookies, | 180 const ResponseCookies& cookies, |
181 const std::string& data) { | 181 const std::string& data) { |
182 DCHECK_EQ(url_fetcher_.get(), source); | 182 DCHECK_EQ(url_fetcher_.get(), source); |
183 | 183 |
184 bool error = !status.is_success() || response_code != 200; | 184 bool error = !status.is_success() || response_code != 200; |
185 SpeechInputResultArray result; | 185 SpeechInputResultArray result; |
186 if (!error) | 186 if (!error) |
187 error = !ParseServerResponse(data, &result); | 187 error = !ParseServerResponse(data, &result); |
188 url_fetcher_.reset(); | 188 url_fetcher_.reset(); |
189 | 189 |
190 DVLOG(1) << "SpeechRecognitionRequest: Invoking delegate with result."; | 190 DVLOG(1) << "SpeechRecognitionRequest: Invoking delegate with result."; |
191 delegate_->SetRecognitionResult(error, result); | 191 delegate_->SetRecognitionResult(error, result); |
192 } | 192 } |
193 | 193 |
194 } // namespace speech_input | 194 } // namespace speech_input |
OLD | NEW |