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

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

Issue 6338002: net: Remove typedef net::URLRequestContext URLRequestContext; (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: for real Created 9 years, 11 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 "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"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 const std::string& audio_data) { 127 const std::string& audio_data) {
128 DCHECK(!url_fetcher_.get()); 128 DCHECK(!url_fetcher_.get());
129 129
130 std::vector<std::string> parts; 130 std::vector<std::string> parts;
131 131
132 std::string lang_param = language; 132 std::string lang_param = language;
133 if (lang_param.empty() && url_context_) { 133 if (lang_param.empty() && url_context_) {
134 // If no language is provided then we use the first from the accepted 134 // If no language is provided then we use the first from the accepted
135 // language list. If this list is empty then it defaults to "en-US". 135 // language list. If this list is empty then it defaults to "en-US".
136 // Example of the contents of this list: "es,en-GB;q=0.8", "" 136 // Example of the contents of this list: "es,en-GB;q=0.8", ""
137 URLRequestContext* request_context = url_context_->GetURLRequestContext(); 137 net::URLRequestContext* request_context =
138 url_context_->GetURLRequestContext();
138 DCHECK(request_context); 139 DCHECK(request_context);
139 std::string accepted_language_list = request_context->accept_language(); 140 std::string accepted_language_list = request_context->accept_language();
140 size_t separator = accepted_language_list.find_first_of(",;"); 141 size_t separator = accepted_language_list.find_first_of(",;");
141 lang_param = accepted_language_list.substr(0, separator); 142 lang_param = accepted_language_list.substr(0, separator);
142 } 143 }
143 if (lang_param.empty()) 144 if (lang_param.empty())
144 lang_param = "en-US"; 145 lang_param = "en-US";
145 parts.push_back("lang=" + EscapeQueryParamValue(lang_param, true)); 146 parts.push_back("lang=" + EscapeQueryParamValue(lang_param, true));
146 147
147 if (!grammar.empty()) 148 if (!grammar.empty())
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 SpeechInputResultArray result; 186 SpeechInputResultArray result;
186 if (!error) 187 if (!error)
187 error = !ParseServerResponse(data, &result); 188 error = !ParseServerResponse(data, &result);
188 url_fetcher_.reset(); 189 url_fetcher_.reset();
189 190
190 DVLOG(1) << "SpeechRecognitionRequest: Invoking delegate with result."; 191 DVLOG(1) << "SpeechRecognitionRequest: Invoking delegate with result.";
191 delegate_->SetRecognitionResult(error, result); 192 delegate_->SetRecognitionResult(error, result);
192 } 193 }
193 194
194 } // namespace speech_input 195 } // namespace speech_input
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698