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

Unified Diff: chrome/browser/ui/app_list/start_page_service.cc

Issue 778393002: Add OAuth2 authentication for some voice transcription requests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 6 years 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 | « chrome/browser/ui/app_list/start_page_service.h ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/app_list/start_page_service.cc
diff --git a/chrome/browser/ui/app_list/start_page_service.cc b/chrome/browser/ui/app_list/start_page_service.cc
index b1164a0161222686459cfc0e8395dd38e0f6b553..a271dfb2269259f25d9c78cec2dc42260f312d9e 100644
--- a/chrome/browser/ui/app_list/start_page_service.cc
+++ b/chrome/browser/ui/app_list/start_page_service.cc
@@ -18,6 +18,7 @@
#include "chrome/browser/search/hotword_service.h"
#include "chrome/browser/search/hotword_service_factory.h"
#include "chrome/browser/ui/app_list/recommended_apps.h"
+#include "chrome/browser/ui/app_list/speech_auth_helper.h"
#include "chrome/browser/ui/app_list/speech_recognizer.h"
#include "chrome/browser/ui/app_list/start_page_observer.h"
#include "chrome/browser/ui/app_list/start_page_service_factory.h"
@@ -161,6 +162,7 @@ StartPageService::StartPageService(Profile* profile)
speech_button_toggled_manually_(false),
speech_result_obtained_(false),
webui_finished_loading_(false),
+ speech_auth_helper_(new SpeechAuthHelper(profile, &clock_)),
weak_factory_(this) {
// If experimental hotwording is enabled, then we're always "ready".
// Transitioning into the "hotword recognizing" state is handled by the
@@ -344,11 +346,26 @@ content::WebContents* StartPageService::GetSpeechContents() {
return GetSpeechRecognitionContents();
}
+void StartPageService::GetSpeechAuthParameters(std::string* auth_scope,
+ std::string* auth_token) {
+ if (HotwordService::IsExperimentalHotwordingEnabled()) {
+ HotwordService* service = HotwordServiceFactory::GetForProfile(profile_);
+ if (service &&
+ service->IsOptedIntoAudioLogging() &&
+ !speech_auth_helper_->GetToken().empty()) {
+ *auth_scope = speech_auth_helper_->GetScope();
+ *auth_token = speech_auth_helper_->GetToken();
+ }
+ }
+}
+
void StartPageService::Shutdown() {
UnloadContents();
#if defined(OS_CHROMEOS)
audio_status_.reset();
#endif
+
+ speech_auth_helper_.reset();
}
void StartPageService::WebUILoaded() {
« no previous file with comments | « chrome/browser/ui/app_list/start_page_service.h ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698