Commit 90a2ac58 authored by evliu's avatar evliu Committed by Commit Bot

Secure SODA with an API key

This CL secures SODA with an API key as outlined in go/securing-soda-on-chrome.

Bug: 1107615
Change-Id: I7239c4f369c52360c293fc33959f99c044503ab3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2314987Reviewed-by: default avatarBecca Hughes <beccahughes@chromium.org>
Commit-Queue: Evan Liu <evliu@google.com>
Cr-Commit-Position: refs/heads/master@{#792424}
parent fd299fbd
......@@ -19,6 +19,7 @@
#if BUILDFLAG(ENABLE_SODA)
#include "chrome/services/soda/internal/soda_client.h"
#include "google_apis/google_api_keys.h"
#endif // BUILDFLAG(ENABLE_SODA)
namespace speech {
......@@ -124,12 +125,14 @@ void SpeechRecognitionRecognizerImpl::SendAudioToSpeechRecognitionService(
soda_client_->DidAudioPropertyChange(sample_rate, channel_count)) {
// Initialize the SODA instance.
auto config_file_path = GetSodaConfigPath().value();
auto api_key = google_apis::GetSodaAPIKey();
SodaConfig config;
config.channel_count = channel_count;
config.sample_rate = sample_rate;
config.config_file = config_file_path.c_str();
config.callback = RecognitionCallback;
config.callback_handle = this;
config.api_key = api_key.c_str();
soda_client_->Reset(config);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment