[omnibox-next] Remove tabSuggestions from cr-composebox.

This prevents chips from showing in composebox.

Fixed: b:467338031
Change-Id: I9b18b1fc1e10ba5c0998ac6912abf772a373701a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7256994
Reviewed-by: Teresa Mao <temao@chromium.org>
Commit-Queue: Teresa Mao <temao@chromium.org>
Reviewed-by: Paul Adedeji <pauladedeji@google.com>
Cr-Commit-Position: refs/heads/main@{#1558463}
diff --git a/chrome/test/data/webui/new_tab_page/composebox/composebox_test.ts b/chrome/test/data/webui/new_tab_page/composebox/composebox_test.ts
index 76a64e3..a5baaf1 100644
--- a/chrome/test/data/webui/new_tab_page/composebox/composebox_test.ts
+++ b/chrome/test/data/webui/new_tab_page/composebox/composebox_test.ts
@@ -7,7 +7,8 @@
 import {$$} from 'chrome://new-tab-page/new_tab_page.js';
 import {PageCallbackRouter, PageHandlerRemote} from 'chrome://resources/cr_components/composebox/composebox.mojom-webui.js';
 import {FileUploadErrorType, FileUploadStatus} from 'chrome://resources/cr_components/composebox/composebox_query.mojom-webui.js';
-import type {RecentTabChipElement} from 'chrome://resources/cr_components/composebox/recent_tab_chip.js';
+// import type {RecentTabChipElement} from
+// 'chrome://resources/cr_components/composebox/recent_tab_chip.js';
 import {loadTimeData} from 'chrome://resources/js/load_time_data.js';
 import {PageCallbackRouter as SearchboxPageCallbackRouter, PageHandlerRemote as SearchboxPageHandlerRemote} from 'chrome://resources/mojo/components/omnibox/browser/searchbox.mojom-webui.js';
 import type {AutocompleteMatch, AutocompleteResult, PageRemote as SearchboxPageRemote} from 'chrome://resources/mojo/components/omnibox/browser/searchbox.mojom-webui.js';
@@ -2524,30 +2525,17 @@
       assertEquals(files[0]!.name, sampleTabTitle);
     });
 
-    test('recent tab chip shows first available suggestion', async () => {
+    test('recent tab chip does not show when matches are present', async () => {
       loadTimeData.overrideValues(
         {composeboxShowZps: true, composeboxShowTypedSuggest: true});
-      const tabInfo1 = {
+      const tabInfo = {
         tabId: 1,
         title: 'Tab 1',
         url: {url: 'https://www.google.com/search?q=foo'},
         showInRecentTabChip: false,
       };
-      const tabInfo2 = {
-        tabId: 2,
-        title: 'Tab 2',
-        url: {url: 'https://www.example.com'},
-        showInRecentTabChip: true,
-      };
-      const tabInfo3 = {
-        tabId: 3,
-        title: 'Tab 3',
-        url: {url: 'https://www.chromium.org'},
-        showInRecentTabChip: true,
-      };
       searchboxHandler.setResultFor(
-          'getRecentTabs',
-          Promise.resolve({tabs: [tabInfo1, tabInfo2, tabInfo3]}));
+          'getRecentTabs', Promise.resolve({tabs: [tabInfo]}));
       createComposeboxElement();
       await microtasksFinished();
 
@@ -2577,57 +2565,10 @@
 
       // Dropdown should show when matches are available.
       assertFalse(composeboxDropdown.hidden);
+
+      // Recent tab chip should not show when matches are present.
       recentTabChip = await getRecentTabChip();
-      assertTrue(!!recentTabChip);
-      assertEquals(tabInfo2, (recentTabChip as RecentTabChipElement).recentTab);
-      assertEquals(3, composeboxElement.$.context.tabSuggestions.length);
-    });
-
-    test('hides recent tab chip when tab is in context', async () => {
-      const tabInfo = {
-        tabId: 1,
-        title: 'Sample Tab',
-        url: {url: 'https://example.com'},
-        showInRecentTabChip: true,
-        lastActive: {internalValue: 0n},
-      };
-      searchboxHandler.setResultFor(
-          'getRecentTabs', Promise.resolve({tabs: [tabInfo]}));
-      createComposeboxElement();
-      const contextElement = composeboxElement.$.context;
-      await microtasksFinished();
-      await contextElement.updateComplete;
-
-      // Add zps matches to ensure recent tab chip is visible.
-      composeboxElement.$.input.value = '';
-      composeboxElement.$.input.dispatchEvent(new Event('input'));
-      await microtasksFinished();
-      const matches = [
-        createSearchMatch(),
-        createSearchMatch({fillIntoEdit: 'hello world 2'}),
-      ];
-      searchboxCallbackRouterRemote.autocompleteResultChanged(
-          createAutocompleteResult({
-            matches: matches,
-          }));
-      await microtasksFinished();
-
-      let recentTabChip = await getRecentTabChip();
-      assertTrue(recentTabChip !== null);
-
-      // Add the tab to the context.
-      searchboxHandler.setResultFor(
-          ADD_TAB_CONTEXT_FN,
-          Promise.resolve({token: {low: BigInt(1), high: BigInt(2)}}));
-
-      recentTabChip.shadowRoot!.querySelector<HTMLElement>(
-                                   'cr-button')!.click();
-      await searchboxHandler.whenCalled(ADD_TAB_CONTEXT_FN);
-      await microtasksFinished();
-
-      recentTabChip = await getRecentTabChip();
-
-      assertTrue(recentTabChip === null);
+      assertFalse(!!recentTabChip);
     });
 
     test('setSearchContext sets input and queries autocomplete', async () => {
diff --git a/ui/webui/resources/cr_components/composebox/composebox.html.ts b/ui/webui/resources/cr_components/composebox/composebox.html.ts
index ed6f58eb..8af4a16 100644
--- a/ui/webui/resources/cr_components/composebox/composebox.html.ts
+++ b/ui/webui/resources/cr_components/composebox/composebox.html.ts
@@ -79,7 +79,6 @@
       <contextual-entrypoint-and-carousel id="context" part="context-entrypoint"
           class="${this.carouselOnTop_ && this.isCollapsible ? 'icon-fade' : ''}"
           exportparts="context-menu-entrypoint-icon, cr-composebox-file-carousel, upload-container, voice-icon, carousel-divider, carousel-container"
-          .tabSuggestions="${this.tabSuggestions_}"
           .entrypointName="${this.entrypointName ? this.entrypointName : 'Composebox'}"
           @add-tab-context="${this.addTabContext_}"
           @open-voice-search="${this.openAimVoiceSearch_}"
diff --git a/ui/webui/resources/cr_components/composebox/composebox.ts b/ui/webui/resources/cr_components/composebox/composebox.ts
index c46efaa..6bf0a20 100644
--- a/ui/webui/resources/cr_components/composebox/composebox.ts
+++ b/ui/webui/resources/cr_components/composebox/composebox.ts
@@ -157,7 +157,6 @@
         type: Boolean,
         reflect: true,
       },
-      tabSuggestions_: {type: Array},
       errorScrimVisible_: {type: Boolean},
       contextFilesSize_: {
         type: Number,
@@ -220,7 +219,6 @@
   protected accessor inDeepSearchMode_: boolean = false;
   protected accessor showContextMenuDescription_: boolean = true;
   protected accessor lensButtonDisabled_: boolean = false;
-  protected accessor tabSuggestions_: TabInfo[] = [];
   protected accessor errorScrimVisible_: boolean = false;
   protected accessor contextFilesSize_: number = 0;
   protected accessor transcript_: string = '';
@@ -277,8 +275,6 @@
           this.onAutocompleteResultChanged_.bind(this)),
       this.searchboxCallbackRouter_.onContextualInputStatusChanged.addListener(
           this.onContextualInputStatusChanged_.bind(this)),
-      this.searchboxCallbackRouter_.onTabStripChanged.addListener(
-          this.refreshTabSuggestions_.bind(this)),
       this.searchboxCallbackRouter_.addFileContext.addListener(
           this.addFileContextFromBrowser_.bind(this)),
       this.searchboxCallbackRouter_.updateAutoSuggestedTabContext.addListener(
@@ -313,7 +309,6 @@
     }
 
     this.searchboxHandler_.notifySessionStarted();
-    this.refreshTabSuggestions_();
 
     if (this.ntpRealboxNextEnabled) {
       this.fire('composebox-initialized', {
@@ -700,11 +695,6 @@
     }
   }
 
-  protected async refreshTabSuggestions_() {
-    const {tabs} = await this.searchboxHandler_.getRecentTabs();
-    this.tabSuggestions_ = [...tabs];
-  }
-
   protected async getTabPreview_(e: CustomEvent<{
     tabId: number,
     onPreviewFetched: (previewDataUrl: string) => void,