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 @@
<message name="IDS_SETTINGS_SEARCH_GOOGLE_ASSISTANT_DISABLED" desc="Sub label for the Google Assistant button when Assistant is disabled.">
Disabled
</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>
<!-- Search Engines Page -->
......
......@@ -174,16 +174,7 @@
<template is="dom-if" if="[[showPage_(pageVisibility.search)]]" restamp>
<settings-section page-title="$i18n{searchPageTitle}"
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>
</if>
</settings-section>
</template>
<if expr="chromeos">
......
......@@ -150,11 +150,7 @@
<template is="dom-if" if="[[showPage_(pageVisibility.search)]]" restamp>
<settings-section page-title="$i18n{searchPageTitle}"
section="search">
<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>
<settings-search-page prefs="{{prefs}}"></settings-search-page>
</settings-section>
</template>
<template is="dom-if" if="[[shouldCreateAndroidAppsSection_(
......
......@@ -52,7 +52,7 @@
label="$i18n{googleAssistantEnableContext}"
sub-label="$i18n{googleAssistantEnableContextDescription}">
</settings-toggle-button>
<template is="dom-if" if="[[assistantFeatureEnabled_]]">
<template is="dom-if" if="[[isAssistantAllowed_]]">
<settings-toggle-button id="google-assistant-hotword-enable"
pref="{{prefs.settings.voice_interaction.hotword.enabled}}"
label="$i18n{googleAssistantEnableHotword}"
......
......@@ -45,10 +45,10 @@ Polymer({
properties: {
/** @private */
assistantFeatureEnabled_: {
isAssistantAllowed_: {
type: Boolean,
value: function() {
return loadTimeData.getBoolean('enableAssistant');
return loadTimeData.getBoolean('isAssistantAllowed');
},
},
......
......@@ -68,8 +68,6 @@ cr.define('settings', function() {
* @return {!Promise<boolean>}
*/
validateSearchEngineInput(fieldName, fieldValue) {}
turnOnGoogleAssistant() {}
}
/**
......@@ -115,11 +113,6 @@ cr.define('settings', function() {
return cr.sendWithPromise(
'validateSearchEngineInput', fieldName, fieldValue);
}
/** @override */
turnOnGoogleAssistant() {
chrome.send('turnOnGoogleAssistant');
}
}
// The singleton instance_ is replaced with a test version of this wrapper
......
......@@ -6,7 +6,6 @@
<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/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/settings_toggle_button.html">
<link rel="import" href="../icons.html">
......@@ -86,7 +85,7 @@
<if expr="chromeos">
<!-- Google Assistant -->
<template is="dom-if" if="[[voiceInteractionFeatureEnabled_]]">
<template is="dom-if" if="[[isAssistantAllowed_]]">
<div id="assistant-subpage-trigger" class="settings-box two-line"
on-click="onGoogleAssistantTap_" actionable>
<div class="start">
......@@ -96,19 +95,8 @@
prefs.settings.voice_interaction.enabled.value)]]
</div>
</div>
<template is="dom-if" if="[[assistantOn_]]">
<cr-icon-button class="subpage-arrow"
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>
</template>
</if>
......@@ -123,7 +111,7 @@
</settings-subpage>
</template>
<if expr="chromeos">
<template is="dom-if" if="[[voiceInteractionFeatureEnabled_]]">
<template is="dom-if" if="[[isAssistantAllowed_]]">
<template is="dom-if" route-path="/googleAssistant">
<settings-subpage
associated-control="[[$$('#assistant-subpage-trigger')]]"
......
......@@ -14,12 +14,6 @@ Polymer({
properties: {
prefs: Object,
// <if expr="chromeos">
arcEnabled: Boolean,
voiceInteractionValuePropAccepted: Boolean,
// </if>
/**
* List of default search engines available.
* @private {!Array<!SearchEngine>}
......@@ -38,28 +32,13 @@ Polymer({
focusConfig_: Object,
// <if expr="chromeos">
/** @private */
voiceInteractionFeatureEnabled_: {
/** @private Can be disallowed due to flag, policy, locale, etc. */
isAssistantAllowed_: {
type: Boolean,
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>
},
......@@ -115,19 +94,9 @@ Polymer({
// <if expr="chromeos">
/** @private */
onGoogleAssistantTap_: function() {
assert(this.voiceInteractionFeatureEnabled_);
if (!this.assistantOn_) {
return;
}
assert(this.isAssistantAllowed_);
settings.navigateTo(settings.routes.GOOGLE_ASSISTANT);
},
/** @private */
onAssistantTurnOnTap_: function(event) {
this.browserProxy_.turnOnGoogleAssistant();
},
// </if>
// <if expr="chromeos">
......@@ -141,17 +110,6 @@ Polymer({
toggleValue ? 'searchGoogleAssistantEnabled' :
'searchGoogleAssistantDisabled');
},
/** @private
* @param {boolean} arcEnabled
* @param {boolean} valuePropAccepted
* @param {boolean} assistantFeatureEnabled
* @return {boolean}
*/
isAssistantTurnedOn_: function(
arcEnabled, valuePropAccepted, assistantFeatureEnabled) {
return (arcEnabled && valuePropAccepted) || assistantFeatureEnabled;
},
// </if>
/**
......
......@@ -2200,6 +2200,7 @@ void AddSearchInSettingsStrings(content::WebUIDataSource* html_source) {
void AddSearchStrings(content::WebUIDataSource* html_source, Profile* profile) {
#if defined(OS_CHROMEOS)
// NOTE: This will be false when the flag is disabled.
const bool is_assistant_allowed =
assistant::IsAssistantAllowedForProfile(profile) ==
ash::mojom::AssistantAllowedState::ALLOWED;
......@@ -2219,7 +2220,6 @@ void AddSearchStrings(content::WebUIDataSource* html_source, Profile* profile) {
IDS_SETTINGS_SEARCH_GOOGLE_ASSISTANT_ENABLED},
{"searchGoogleAssistantDisabled",
IDS_SETTINGS_SEARCH_GOOGLE_ASSISTANT_DISABLED},
{"assistantTurnOn", IDS_SETTINGS_SEARCH_GOOGLE_ASSISTANT_TURN_ON},
#endif
};
AddLocalizedStringsBulk(html_source, localized_strings,
......@@ -2229,9 +2229,7 @@ void AddSearchStrings(content::WebUIDataSource* html_source, Profile* profile) {
base::ASCIIToUTF16(chrome::kOmniboxLearnMoreURL));
html_source->AddString("searchExplanation", search_explanation_text);
#if defined(OS_CHROMEOS)
html_source->AddBoolean("enableVoiceInteraction", is_assistant_allowed);
html_source->AddBoolean("enableAssistant",
chromeos::switches::IsAssistantEnabled());
html_source->AddBoolean("isAssistantAllowed", is_assistant_allowed);
#endif
}
......
......@@ -40,7 +40,7 @@ suite('GoogleAssistantHandler', function() {
suiteSetup(function() {
loadTimeData.overrideValues({
enableAssistant: true,
isAssistantAllowed: true,
voiceMatchEnabled: true,
hotwordDspAvailable: true,
});
......@@ -326,7 +326,7 @@ suite('GoogleAssistantHandlerWihtNoDspHotword', function() {
suiteSetup(function() {
loadTimeData.overrideValues({
enableAssistant: true,
isAssistantAllowed: true,
voiceMatchEnabled: true,
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