Commit 4780f1e7 authored by James Cook's avatar James Cook Committed by Commit Bot

cros: Remove unused Assistant WebUI code in search settings

The conversion from ARC to native assistant left some dead code in
settings.

Bug: 960937
Test: turned assistant feature flag on and off in about:flags
Change-Id: Icb4b03aee055cfffbd9118c56661c6431debac65
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1602658Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Reviewed-by: default avatarXiaohui Chen <xiaohuic@chromium.org>
Reviewed-by: default avatarYue Li <updowndota@chromium.org>
Commit-Queue: James Cook <jamescook@chromium.org>
Cr-Commit-Position: refs/heads/master@{#658375}
parent 45c3ca4d
...@@ -2775,9 +2775,6 @@ ...@@ -2775,9 +2775,6 @@
<message name="IDS_SETTINGS_SEARCH_GOOGLE_ASSISTANT_DISABLED" desc="Sub label for the Google Assistant button when Assistant is disabled."> <message name="IDS_SETTINGS_SEARCH_GOOGLE_ASSISTANT_DISABLED" desc="Sub label for the Google Assistant button when Assistant is disabled.">
Disabled Disabled
</message> </message>
<message name="IDS_SETTINGS_SEARCH_GOOGLE_ASSISTANT_TURN_ON" desc="Label for the Google Assistant button when ARC is disabled or value prop is not accepted.">
Enable
</message>
</if> </if>
<!-- Search Engines Page --> <!-- Search Engines Page -->
......
...@@ -174,16 +174,7 @@ ...@@ -174,16 +174,7 @@
<template is="dom-if" if="[[showPage_(pageVisibility.search)]]" restamp> <template is="dom-if" if="[[showPage_(pageVisibility.search)]]" restamp>
<settings-section page-title="$i18n{searchPageTitle}" <settings-section page-title="$i18n{searchPageTitle}"
section="search"> section="search">
<if expr="chromeos">
<settings-search-page prefs="{{prefs}}"
arc-enabled="[[prefs.arc.enabled.value]]"
voice-interaction-value-prop-accepted="[[
prefs.arc.voice_interaction_value_prop.accepted.value]]">
</settings-search-page>
</if>
<if expr="not chromeos">
<settings-search-page prefs="{{prefs}}"></settings-search-page> <settings-search-page prefs="{{prefs}}"></settings-search-page>
</if>
</settings-section> </settings-section>
</template> </template>
<if expr="chromeos"> <if expr="chromeos">
......
...@@ -150,11 +150,7 @@ ...@@ -150,11 +150,7 @@
<template is="dom-if" if="[[showPage_(pageVisibility.search)]]" restamp> <template is="dom-if" if="[[showPage_(pageVisibility.search)]]" restamp>
<settings-section page-title="$i18n{searchPageTitle}" <settings-section page-title="$i18n{searchPageTitle}"
section="search"> section="search">
<settings-search-page prefs="{{prefs}}" <settings-search-page prefs="{{prefs}}"></settings-search-page>
arc-enabled="[[prefs.arc.enabled.value]]"
voice-interaction-value-prop-accepted="[[
prefs.arc.voice_interaction_value_prop.accepted.value]]">
</settings-search-page>
</settings-section> </settings-section>
</template> </template>
<template is="dom-if" if="[[shouldCreateAndroidAppsSection_( <template is="dom-if" if="[[shouldCreateAndroidAppsSection_(
......
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
label="$i18n{googleAssistantEnableContext}" label="$i18n{googleAssistantEnableContext}"
sub-label="$i18n{googleAssistantEnableContextDescription}"> sub-label="$i18n{googleAssistantEnableContextDescription}">
</settings-toggle-button> </settings-toggle-button>
<template is="dom-if" if="[[assistantFeatureEnabled_]]"> <template is="dom-if" if="[[isAssistantAllowed_]]">
<settings-toggle-button id="google-assistant-hotword-enable" <settings-toggle-button id="google-assistant-hotword-enable"
pref="{{prefs.settings.voice_interaction.hotword.enabled}}" pref="{{prefs.settings.voice_interaction.hotword.enabled}}"
label="$i18n{googleAssistantEnableHotword}" label="$i18n{googleAssistantEnableHotword}"
......
...@@ -45,10 +45,10 @@ Polymer({ ...@@ -45,10 +45,10 @@ Polymer({
properties: { properties: {
/** @private */ /** @private */
assistantFeatureEnabled_: { isAssistantAllowed_: {
type: Boolean, type: Boolean,
value: function() { value: function() {
return loadTimeData.getBoolean('enableAssistant'); return loadTimeData.getBoolean('isAssistantAllowed');
}, },
}, },
......
...@@ -68,8 +68,6 @@ cr.define('settings', function() { ...@@ -68,8 +68,6 @@ cr.define('settings', function() {
* @return {!Promise<boolean>} * @return {!Promise<boolean>}
*/ */
validateSearchEngineInput(fieldName, fieldValue) {} validateSearchEngineInput(fieldName, fieldValue) {}
turnOnGoogleAssistant() {}
} }
/** /**
...@@ -115,11 +113,6 @@ cr.define('settings', function() { ...@@ -115,11 +113,6 @@ cr.define('settings', function() {
return cr.sendWithPromise( return cr.sendWithPromise(
'validateSearchEngineInput', fieldName, fieldValue); 'validateSearchEngineInput', fieldName, fieldValue);
} }
/** @override */
turnOnGoogleAssistant() {
chrome.send('turnOnGoogleAssistant');
}
} }
// The singleton instance_ is replaced with a test version of this wrapper // The singleton instance_ is replaced with a test version of this wrapper
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
<link rel="import" href="chrome://resources/html/assert.html"> <link rel="import" href="chrome://resources/html/assert.html">
<link rel="import" href="chrome://resources/html/i18n_behavior.html"> <link rel="import" href="chrome://resources/html/i18n_behavior.html">
<link rel="import" href="chrome://resources/html/md_select_css.html"> <link rel="import" href="chrome://resources/html/md_select_css.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
<link rel="import" href="../controls/extension_controlled_indicator.html"> <link rel="import" href="../controls/extension_controlled_indicator.html">
<link rel="import" href="../controls/settings_toggle_button.html"> <link rel="import" href="../controls/settings_toggle_button.html">
<link rel="import" href="../icons.html"> <link rel="import" href="../icons.html">
...@@ -86,7 +85,7 @@ ...@@ -86,7 +85,7 @@
<if expr="chromeos"> <if expr="chromeos">
<!-- Google Assistant --> <!-- Google Assistant -->
<template is="dom-if" if="[[voiceInteractionFeatureEnabled_]]"> <template is="dom-if" if="[[isAssistantAllowed_]]">
<div id="assistant-subpage-trigger" class="settings-box two-line" <div id="assistant-subpage-trigger" class="settings-box two-line"
on-click="onGoogleAssistantTap_" actionable> on-click="onGoogleAssistantTap_" actionable>
<div class="start"> <div class="start">
...@@ -96,19 +95,8 @@ ...@@ -96,19 +95,8 @@
prefs.settings.voice_interaction.enabled.value)]] prefs.settings.voice_interaction.enabled.value)]]
</div> </div>
</div> </div>
<template is="dom-if" if="[[assistantOn_]]">
<cr-icon-button class="subpage-arrow" <cr-icon-button class="subpage-arrow"
aria-label="$i18n{searchGoogleAssistant}"></cr-icon-button> aria-label="$i18n{searchGoogleAssistant}"></cr-icon-button>
</template>
<template is="dom-if" if="[[!assistantOn_]]">
<div class="separator"></div>
<paper-button id="enable" class="secondary-button"
on-click="onAssistantTurnOnTap_"
aria-label="$i18n{searchPageTitle}"
aria-describedby="secondaryText">
$i18n{assistantTurnOn}
</paper-button>
</template>
</div> </div>
</template> </template>
</if> </if>
...@@ -123,7 +111,7 @@ ...@@ -123,7 +111,7 @@
</settings-subpage> </settings-subpage>
</template> </template>
<if expr="chromeos"> <if expr="chromeos">
<template is="dom-if" if="[[voiceInteractionFeatureEnabled_]]"> <template is="dom-if" if="[[isAssistantAllowed_]]">
<template is="dom-if" route-path="/googleAssistant"> <template is="dom-if" route-path="/googleAssistant">
<settings-subpage <settings-subpage
associated-control="[[$$('#assistant-subpage-trigger')]]" associated-control="[[$$('#assistant-subpage-trigger')]]"
......
...@@ -14,12 +14,6 @@ Polymer({ ...@@ -14,12 +14,6 @@ Polymer({
properties: { properties: {
prefs: Object, prefs: Object,
// <if expr="chromeos">
arcEnabled: Boolean,
voiceInteractionValuePropAccepted: Boolean,
// </if>
/** /**
* List of default search engines available. * List of default search engines available.
* @private {!Array<!SearchEngine>} * @private {!Array<!SearchEngine>}
...@@ -38,28 +32,13 @@ Polymer({ ...@@ -38,28 +32,13 @@ Polymer({
focusConfig_: Object, focusConfig_: Object,
// <if expr="chromeos"> // <if expr="chromeos">
/** @private */ /** @private Can be disallowed due to flag, policy, locale, etc. */
voiceInteractionFeatureEnabled_: { isAssistantAllowed_: {
type: Boolean, type: Boolean,
value: function() { value: function() {
return loadTimeData.getBoolean('enableVoiceInteraction'); return loadTimeData.getBoolean('isAssistantAllowed');
}, },
}, },
/** @private */
assistantFeatureEnabled_: {
type: Boolean,
value: function() {
return loadTimeData.getBoolean('enableAssistant');
},
},
/** @private */
assistantOn_: {
type: Boolean,
computed: 'isAssistantTurnedOn_(arcEnabled, ' +
'voiceInteractionValuePropAccepted, assistantFeatureEnabled_)',
}
// </if> // </if>
}, },
...@@ -115,19 +94,9 @@ Polymer({ ...@@ -115,19 +94,9 @@ Polymer({
// <if expr="chromeos"> // <if expr="chromeos">
/** @private */ /** @private */
onGoogleAssistantTap_: function() { onGoogleAssistantTap_: function() {
assert(this.voiceInteractionFeatureEnabled_); assert(this.isAssistantAllowed_);
if (!this.assistantOn_) {
return;
}
settings.navigateTo(settings.routes.GOOGLE_ASSISTANT); settings.navigateTo(settings.routes.GOOGLE_ASSISTANT);
}, },
/** @private */
onAssistantTurnOnTap_: function(event) {
this.browserProxy_.turnOnGoogleAssistant();
},
// </if> // </if>
// <if expr="chromeos"> // <if expr="chromeos">
...@@ -141,17 +110,6 @@ Polymer({ ...@@ -141,17 +110,6 @@ Polymer({
toggleValue ? 'searchGoogleAssistantEnabled' : toggleValue ? 'searchGoogleAssistantEnabled' :
'searchGoogleAssistantDisabled'); 'searchGoogleAssistantDisabled');
}, },
/** @private
* @param {boolean} arcEnabled
* @param {boolean} valuePropAccepted
* @param {boolean} assistantFeatureEnabled
* @return {boolean}
*/
isAssistantTurnedOn_: function(
arcEnabled, valuePropAccepted, assistantFeatureEnabled) {
return (arcEnabled && valuePropAccepted) || assistantFeatureEnabled;
},
// </if> // </if>
/** /**
......
...@@ -2200,6 +2200,7 @@ void AddSearchInSettingsStrings(content::WebUIDataSource* html_source) { ...@@ -2200,6 +2200,7 @@ void AddSearchInSettingsStrings(content::WebUIDataSource* html_source) {
void AddSearchStrings(content::WebUIDataSource* html_source, Profile* profile) { void AddSearchStrings(content::WebUIDataSource* html_source, Profile* profile) {
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
// NOTE: This will be false when the flag is disabled.
const bool is_assistant_allowed = const bool is_assistant_allowed =
assistant::IsAssistantAllowedForProfile(profile) == assistant::IsAssistantAllowedForProfile(profile) ==
ash::mojom::AssistantAllowedState::ALLOWED; ash::mojom::AssistantAllowedState::ALLOWED;
...@@ -2219,7 +2220,6 @@ void AddSearchStrings(content::WebUIDataSource* html_source, Profile* profile) { ...@@ -2219,7 +2220,6 @@ void AddSearchStrings(content::WebUIDataSource* html_source, Profile* profile) {
IDS_SETTINGS_SEARCH_GOOGLE_ASSISTANT_ENABLED}, IDS_SETTINGS_SEARCH_GOOGLE_ASSISTANT_ENABLED},
{"searchGoogleAssistantDisabled", {"searchGoogleAssistantDisabled",
IDS_SETTINGS_SEARCH_GOOGLE_ASSISTANT_DISABLED}, IDS_SETTINGS_SEARCH_GOOGLE_ASSISTANT_DISABLED},
{"assistantTurnOn", IDS_SETTINGS_SEARCH_GOOGLE_ASSISTANT_TURN_ON},
#endif #endif
}; };
AddLocalizedStringsBulk(html_source, localized_strings, AddLocalizedStringsBulk(html_source, localized_strings,
...@@ -2229,9 +2229,7 @@ void AddSearchStrings(content::WebUIDataSource* html_source, Profile* profile) { ...@@ -2229,9 +2229,7 @@ void AddSearchStrings(content::WebUIDataSource* html_source, Profile* profile) {
base::ASCIIToUTF16(chrome::kOmniboxLearnMoreURL)); base::ASCIIToUTF16(chrome::kOmniboxLearnMoreURL));
html_source->AddString("searchExplanation", search_explanation_text); html_source->AddString("searchExplanation", search_explanation_text);
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
html_source->AddBoolean("enableVoiceInteraction", is_assistant_allowed); html_source->AddBoolean("isAssistantAllowed", is_assistant_allowed);
html_source->AddBoolean("enableAssistant",
chromeos::switches::IsAssistantEnabled());
#endif #endif
} }
......
...@@ -40,7 +40,7 @@ suite('GoogleAssistantHandler', function() { ...@@ -40,7 +40,7 @@ suite('GoogleAssistantHandler', function() {
suiteSetup(function() { suiteSetup(function() {
loadTimeData.overrideValues({ loadTimeData.overrideValues({
enableAssistant: true, isAssistantAllowed: true,
voiceMatchEnabled: true, voiceMatchEnabled: true,
hotwordDspAvailable: true, hotwordDspAvailable: true,
}); });
...@@ -326,7 +326,7 @@ suite('GoogleAssistantHandlerWihtNoDspHotword', function() { ...@@ -326,7 +326,7 @@ suite('GoogleAssistantHandlerWihtNoDspHotword', function() {
suiteSetup(function() { suiteSetup(function() {
loadTimeData.overrideValues({ loadTimeData.overrideValues({
enableAssistant: true, isAssistantAllowed: true,
voiceMatchEnabled: true, voiceMatchEnabled: true,
hotwordDspAvailable: false, hotwordDspAvailable: false,
}); });
......
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