chromium/chrome/common/search/search.mojom

// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

module search.mojom;

import "url/mojom/url.mojom";

[Native]
enum NTPLoggingEventType;

[Native]
enum OmniboxFocusState;

[Native]
struct NTPTileImpression;

// Interface used to connect to the embedded search interface. This is a
// separate interface such that a reverse connection (|client| below) can be
// passed when connecting.
interface EmbeddedSearchConnector {
  // Connect to the interface. |embedded_search| is the connection which the
  // client will use to query the embedded search interface. |client| is the
  // connection used by the embedded search interface implementation to push
  // browser state updates to the client.
  Connect(pending_associated_receiver<EmbeddedSearch> embedded_search,
          pending_associated_remote<EmbeddedSearchClient> client);
};


// Browser interface to support embedded search. Render frames connect to this
// interface to query browser data, such as the most visited pages.
// See http://dev.chromium.org/embeddedsearch
interface EmbeddedSearch {
  // Tells InstantExtended to set the omnibox focus state.
  FocusOmnibox(int32 page_seq_no, bool focus);

  // Tells InstantExtended to delete a most visited item.
  DeleteMostVisitedItem(int32 page_seq_no, url.mojom.Url url);

  // Tells InstantExtended to undo all most visited item deletions.
  UndoAllMostVisitedDeletions(int32 page_seq_no);

  // Tells InstantExtended to undo one most visited item deletion.
  UndoMostVisitedDeletion(int32 page_seq_no, url.mojom.Url url);
};

[Native]
enum OmniboxFocusChangeReason;

[Native]
struct InstantMostVisitedInfo;

[Native]
struct NtpTheme;

// Renderer interface used by the browser to push updates to the client. For
// example, the browser will tell the frame if the omnibox got focus.
interface EmbeddedSearchClient {
  // Update the page sequence number for the page.
  SetPageSequenceNumber(int32 page_seq_no);

  // Focus on the Omnibox has changed, the fakebox focus state may need to
  // be updated.
  FocusChanged(OmniboxFocusState new_focus_state,
               OmniboxFocusChangeReason reason);

  // The data for the NTP shortcuts has changed and shortcuts should be
  // reloaded.
  MostVisitedInfoChanged(InstantMostVisitedInfo most_visited_info);

  // Input into the Omnibox has started/stopped.
  SetInputInProgress(bool input_in_progress);

  // The NTP theme has changed; update accordingly.
  ThemeChanged(NtpTheme theme);
};