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()) { |