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

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

Issue 1223153003: Move JoinString to the base namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: windows Created 5 years, 5 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
OLDNEW
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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 198
199 if (!config_.hardware_info.empty()) 199 if (!config_.hardware_info.empty())
200 parts.push_back("xhw=" + net::EscapeQueryParamValue(config_.hardware_info, 200 parts.push_back("xhw=" + net::EscapeQueryParamValue(config_.hardware_info,
201 true)); 201 true));
202 parts.push_back("maxresults=" + base::UintToString(config_.max_hypotheses)); 202 parts.push_back("maxresults=" + base::UintToString(config_.max_hypotheses));
203 parts.push_back(config_.filter_profanities ? "pfilter=2" : "pfilter=0"); 203 parts.push_back(config_.filter_profanities ? "pfilter=2" : "pfilter=0");
204 204
205 std::string api_key = google_apis::GetAPIKey(); 205 std::string api_key = google_apis::GetAPIKey();
206 parts.push_back("key=" + net::EscapeQueryParamValue(api_key, true)); 206 parts.push_back("key=" + net::EscapeQueryParamValue(api_key, true));
207 207
208 GURL url(std::string(kDefaultSpeechRecognitionUrl) + JoinString(parts, '&')); 208 GURL url(std::string(kDefaultSpeechRecognitionUrl) +
209 base::JoinString(parts, "&"));
209 210
210 encoder_.reset(AudioEncoder::Create(kDefaultAudioCodec, 211 encoder_.reset(AudioEncoder::Create(kDefaultAudioCodec,
211 config_.audio_sample_rate, 212 config_.audio_sample_rate,
212 config_.audio_num_bits_per_sample)); 213 config_.audio_num_bits_per_sample));
213 DCHECK(encoder_.get()); 214 DCHECK(encoder_.get());
214 url_fetcher_ = net::URLFetcher::Create(url_fetcher_id_for_tests, url, 215 url_fetcher_ = net::URLFetcher::Create(url_fetcher_id_for_tests, url,
215 net::URLFetcher::POST, this); 216 net::URLFetcher::POST, this);
216 url_fetcher_->SetChunkedUpload(encoder_->mime_type()); 217 url_fetcher_->SetChunkedUpload(encoder_->mime_type());
217 url_fetcher_->SetRequestContext(url_context_.get()); 218 url_fetcher_->SetRequestContext(url_context_.get());
218 url_fetcher_->SetReferrer(config_.origin_url); 219 url_fetcher_->SetReferrer(config_.origin_url);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 288
288 bool GoogleOneShotRemoteEngine::IsRecognitionPending() const { 289 bool GoogleOneShotRemoteEngine::IsRecognitionPending() const {
289 return url_fetcher_ != NULL; 290 return url_fetcher_ != NULL;
290 } 291 }
291 292
292 int GoogleOneShotRemoteEngine::GetDesiredAudioChunkDurationMs() const { 293 int GoogleOneShotRemoteEngine::GetDesiredAudioChunkDurationMs() const {
293 return kAudioPacketIntervalMs; 294 return kAudioPacketIntervalMs;
294 } 295 }
295 296
296 } // namespace content 297 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/websocket_host.cc ('k') | content/browser/speech/google_streaming_remote_engine.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698