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

Unified Diff: content/browser/speech/google_one_shot_remote_engine.cc

Issue 10909237: Use Google API key for one-shot speech recognition (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/speech/google_one_shot_remote_engine.cc
diff --git a/content/browser/speech/google_one_shot_remote_engine.cc b/content/browser/speech/google_one_shot_remote_engine.cc
index 3c2e2921342719cb2df6c05c1d2acfe95f84a00b..8180844446d65471ecb6a20307273d8f332f9fd7 100644
--- a/content/browser/speech/google_one_shot_remote_engine.cc
+++ b/content/browser/speech/google_one_shot_remote_engine.cc
@@ -13,6 +13,7 @@
#include "content/browser/speech/audio_buffer.h"
#include "content/public/common/speech_recognition_error.h"
#include "content/public/common/speech_recognition_result.h"
+#include "google_apis/google_api_keys.h"
#include "net/base/escape.h"
#include "net/base/load_flags.h"
#include "net/url_request/url_fetcher.h"
@@ -199,6 +200,9 @@ void GoogleOneShotRemoteEngine::StartRecognition() {
parts.push_back("maxresults=" + base::UintToString(config_.max_hypotheses));
parts.push_back(config_.filter_profanities ? "pfilter=2" : "pfilter=0");
+ std::string api_key = google_apis::GetAPIKey();
+ parts.push_back("key=" + net::EscapeQueryParamValue(api_key, true));
+
GURL url(std::string(kDefaultSpeechRecognitionUrl) + JoinString(parts, '&'));
encoder_.reset(AudioEncoder::Create(kDefaultAudioCodec,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698