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

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

Issue 797493002: Eliminate the launcher speech recognizer's dependency on the start page WebContents. (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') | no next file » | 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 a271dfb2269259f25d9c78cec2dc42260f312d9e..f7d64fb9e4342e0dfdff9fe31d2162d7ba1ec4ed 100644
--- a/chrome/browser/ui/app_list/start_page_service.cc
+++ b/chrome/browser/ui/app_list/start_page_service.cc
@@ -224,16 +224,11 @@ void StartPageService::AppListHidden() {
void StartPageService::ToggleSpeechRecognition() {
DCHECK(contents_);
speech_button_toggled_manually_ = true;
- if (!contents_->GetWebUI())
- return;
-
- if (!webui_finished_loading_) {
- pending_webui_callbacks_.push_back(
- base::Bind(&StartPageService::ToggleSpeechRecognition,
- base::Unretained(this)));
- return;
- }
+ // Speech recognition under V2 hotwording does not depend in any way on the
+ // start page web contents. Do this code path first to make this explicit and
+ // easier to identify what code needs to be deleted when V2 hotwording is
+ // stable.
if (HotwordService::IsExperimentalHotwordingEnabled()) {
if (!speech_recognizer_) {
std::string profile_locale;
@@ -254,6 +249,16 @@ void StartPageService::ToggleSpeechRecognition() {
return;
}
+ if (!contents_->GetWebUI())
+ return;
+
+ if (!webui_finished_loading_) {
+ pending_webui_callbacks_.push_back(
+ base::Bind(&StartPageService::ToggleSpeechRecognition,
+ base::Unretained(this)));
+ return;
+ }
+
contents_->GetWebUI()->CallJavascriptFunction(
"appList.startPage.toggleSpeechRecognition");
}
@@ -342,10 +347,6 @@ void StartPageService::OnSpeechRecognitionStateChanged(
OnSpeechRecognitionStateChanged(new_state));
}
-content::WebContents* StartPageService::GetSpeechContents() {
- return GetSpeechRecognitionContents();
-}
-
void StartPageService::GetSpeechAuthParameters(std::string* auth_scope,
std::string* auth_token) {
if (HotwordService::IsExperimentalHotwordingEnabled()) {
« no previous file with comments | « chrome/browser/ui/app_list/start_page_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698