assistant: guard voice match setting ui with flag

The settings ui should only show when feature is enabled.
Also hide the "delete" button for now per ux request.

Bug: b:123254533
Test: locally build and run
Change-Id: Ice44a9888b2d02f901206518967aea2d7bdb43a4
Reviewed-on: https://chromium-review.googlesource.com/c/1434755
Reviewed-by: Steven Bennetts <stevenjb@chromium.org>
Commit-Queue: Xiaohui Chen <xiaohuic@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#626283}(cherry picked from commit 9531fa203126c6a581eac8cd9702093f30f2e564)
Reviewed-on: https://chromium-review.googlesource.com/c/1452507
Reviewed-by: Xiaohui Chen <xiaohuic@chromium.org>
Cr-Commit-Position: refs/branch-heads/3683@{#187}
Cr-Branched-From: e51029943e0a38dd794b73caaf6373d5496ae783-refs/heads/master@{#625896}
diff --git a/chrome/browser/resources/settings/google_assistant_page/google_assistant_page.html b/chrome/browser/resources/settings/google_assistant_page/google_assistant_page.html
index 57fe166..2a44cd9 100644
--- a/chrome/browser/resources/settings/google_assistant_page/google_assistant_page.html
+++ b/chrome/browser/resources/settings/google_assistant_page/google_assistant_page.html
@@ -59,25 +59,26 @@
             </template>
           </select>
         </div>
-        <div class="settings-box two-line" hidden=
-            "[[!prefs.settings.voice_interaction.hotword.enabled.value]]">
-          <div class="start text-area">
-            <div class="label">
-              $i18n{googleAssistantVoiceSettings}
+        <template is="dom-if" if="[[voiceMatchEnabled_]]">
+          <div class="settings-box two-line">
+            <div class="start text-area">
+              <div class="label">
+                $i18n{googleAssistantVoiceSettings}
+              </div>
+              <div class="secondary label">
+                $i18n{googleAssistantVoiceSettingsDescription}
+              </div>
             </div>
-            <div class="secondary label">
-              $i18n{googleAssistantVoiceSettingsDescription}
-            </div>
+            <paper-button id="button" class="secondary-button"
+                on-click="onRetrainVoiceModelTapped_">
+              $i18n{googleAssistantVoiceSettingsRetrainButton}
+            </paper-button>
+            <paper-button id="button" class="secondary-button"
+                on-click="onDeleteVoiceModelTapped_">
+              $i18n{googleAssistantVoiceSettingsDeleteButton}
+            </paper-button>
           </div>
-          <paper-button id="button" class="secondary-button"
-              on-click="onRetrainVoiceModelTapped_">
-            $i18n{googleAssistantVoiceSettingsRetrainButton}
-          </paper-button>
-          <paper-button id="button" class="secondary-button"
-              on-click="onDeleteVoiceModelTapped_">
-            $i18n{googleAssistantVoiceSettingsDeleteButton}
-          </paper-button>
-        </div>
+        </template>
         <settings-toggle-button id="googleAssistantNotificationEnable"
             pref="{{prefs.settings.voice_interaction.notification.enabled}}"
             label="$i18n{googleAssistantEnableNotification}"
diff --git a/chrome/browser/resources/settings/google_assistant_page/google_assistant_page.js b/chrome/browser/resources/settings/google_assistant_page/google_assistant_page.js
index 7aaa74f..8205b12 100644
--- a/chrome/browser/resources/settings/google_assistant_page/google_assistant_page.js
+++ b/chrome/browser/resources/settings/google_assistant_page/google_assistant_page.js
@@ -31,6 +31,12 @@
     },
 
     /** @private */
+    voiceMatchEnabled_: {
+      type: Boolean,
+      value: false,
+    },
+
+    /** @private */
     hotwordDspAvailable_: {
       type: Boolean,
       value: function() {
@@ -148,6 +154,9 @@
   /** @private */
   onPrefsChanged_: function() {
     this.refreshDspHotwordState_();
+
+    this.voiceMatchEnabled_ = loadTimeData.getBoolean('voiceMatchEnabled') &&
+        this.getPref('settings.voice_interaction.hotword.enabled.value');
   },
 
   /** @private */
diff --git a/chrome/browser/ui/webui/settings/md_settings_localized_strings_provider.cc b/chrome/browser/ui/webui/settings/md_settings_localized_strings_provider.cc
index 9d67762..c9b9b21d 100644
--- a/chrome/browser/ui/webui/settings/md_settings_localized_strings_provider.cc
+++ b/chrome/browser/ui/webui/settings/md_settings_localized_strings_provider.cc
@@ -2265,6 +2265,11 @@
 
   html_source->AddBoolean("hotwordDspAvailable",
                           chromeos::IsHotwordDspAvailable());
+
+  html_source->AddBoolean(
+      "voiceMatchEnabled",
+      base::FeatureList::IsEnabled(
+          chromeos::assistant::features::kAssistantVoiceMatch));
 }
 #endif