Commit 69ccb323 authored by amistry's avatar amistry Committed by Commit bot

Guard against the app launcher having a custom start page URL.

Non chrome:// URLs don't have WebUI objects.

BUG=423278

Review URL: https://codereview.chromium.org/657173002

Cr-Commit-Position: refs/heads/master@{#300133}
parent c821d1fd
...@@ -137,7 +137,7 @@ void StartPageService::RemoveObserver(StartPageObserver* observer) { ...@@ -137,7 +137,7 @@ void StartPageService::RemoveObserver(StartPageObserver* observer) {
void StartPageService::AppListShown() { void StartPageService::AppListShown() {
if (!contents_) { if (!contents_) {
LoadContents(); LoadContents();
} else { } else if (contents_->GetWebUI()) {
// If experimental hotwording is enabled, don't enable hotwording in the // If experimental hotwording is enabled, don't enable hotwording in the
// start page, since the hotword extension is taking care of this. // start page, since the hotword extension is taking care of this.
bool hotword_enabled = HotwordEnabled() && bool hotword_enabled = HotwordEnabled() &&
...@@ -149,8 +149,10 @@ void StartPageService::AppListShown() { ...@@ -149,8 +149,10 @@ void StartPageService::AppListShown() {
} }
void StartPageService::AppListHidden() { void StartPageService::AppListHidden() {
contents_->GetWebUI()->CallJavascriptFunction( if (contents_->GetWebUI()) {
"appList.startPage.onAppListHidden"); contents_->GetWebUI()->CallJavascriptFunction(
"appList.startPage.onAppListHidden");
}
if (!app_list::switches::IsExperimentalAppListEnabled()) if (!app_list::switches::IsExperimentalAppListEnabled())
UnloadContents(); UnloadContents();
} }
...@@ -158,6 +160,9 @@ void StartPageService::AppListHidden() { ...@@ -158,6 +160,9 @@ void StartPageService::AppListHidden() {
void StartPageService::ToggleSpeechRecognition() { void StartPageService::ToggleSpeechRecognition() {
DCHECK(contents_); DCHECK(contents_);
speech_button_toggled_manually_ = true; speech_button_toggled_manually_ = true;
if (!contents_->GetWebUI())
return;
if (webui_finished_loading_) { if (webui_finished_loading_) {
contents_->GetWebUI()->CallJavascriptFunction( contents_->GetWebUI()->CallJavascriptFunction(
"appList.startPage.toggleSpeechRecognition"); "appList.startPage.toggleSpeechRecognition");
......
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