blob: 55279215c0a07fae879ecc3e84ae298bf1e23a8e [file] [log] [blame]
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module ash.mojom;
import "components/sync/mojo/syncer.mojom";
import "mojo/public/mojom/base/string16.mojom";
import "mojo/public/mojom/base/unguessable_token.mojom";
import "services/content/public/mojom/navigable_contents_factory.mojom";
import "ui/gfx/geometry/mojo/geometry.mojom";
import "ui/gfx/image/mojo/image.mojom";
import "ui/gfx/range/mojo/range.mojom";
import "url/mojom/url.mojom";
// A structure holding the common information which is sent between ash and,
// chrome representing an app list item.
// This structure should be kept as small as possible so that minimum data
// is sent via mojo calls when an item is moved or reparented.
struct AppListItemMetadata {
string id; // The id of the app list item.
string name; // The corresponding app or folder's name of the item.
string short_name; // The corresponding app's short name of the item. It's
// empty if the app doesn't have one or it's a folder.
string folder_id; // The id of the item's folder.
syncer.mojom.StringOrdinal position; // The position of the item.
bool is_folder; // Whether this item is a folder.
bool is_persistent; // Whether this folder is allowed to contain 1 item.
gfx.mojom.ImageSkia? icon; // The icon of this item.
bool is_page_break; // Whether this item is a "page break" item.
};
// A structure holding the common information which is sent from chrome to ash,
// representing a search result.
struct SearchResultMetadata {
string id; // The id of the result.
mojo_base.mojom.String16 title; // The title of the result, e.g. an app's
// name, an autocomplete query, etc.
mojo_base.mojom.String16 details; // A detail string of this result.
mojo_base.mojom.String16 accessible_name;
// An text to be announced by a screen
// reader app.
array<SearchResultTag> title_tags; // How the title matches the query. See
// the SearchResultTag section for
// more details.
array<SearchResultTag> details_tags; // How the details match the query. See
// the SearchResultTag section for
// more details.
array<SearchResultAction> actions; // Actions that can be performed on this
// result. See the SearchResultAction
// section for more details.
float rating = -1.0; // The average rating score of the app
// corresponding to this result, ranged from 0 to
// 5. It's negative if there's no rating for the
// result.
mojo_base.mojom.String16 formatted_price; // A formatted price string, e.g.
// "$7.09", "HK$3.94", etc.
SearchResultType result_type; // The type of this result.
SearchResultDisplayType display_type = kList;
// How this result is displayed.
double display_score; // A score to determine the result display order.
bool is_omnibox_search; // Whether this result is searched from Omnibox.
bool is_installing; // Whether this result is installing.
url.mojom.Url? query_url; // A query URL associated with this result. The
// meaning and treatment of the URL
// (e.g. displaying inline web contents) is
// dependent on the result type.
string? equivalent_result_id; // An optional id that identifies an equivalent
// result to this result. Answer card result
// has this set to remove the equivalent
// omnibox search-what-you-typed result when
// there is an answer card for the query.
gfx.mojom.ImageSkia? icon; // The icon of this result.
gfx.mojom.ImageSkia? chip_icon; // The icon of this result in a smaller
// dimension to be rendered in suggestion
// chip view.
gfx.mojom.ImageSkia? badge_icon; // The badge icon of this result that
// indicates its type, e.g. installable from
// PlayStore, installable from WebStore,
// etc.
// If set to true, whether or not to send visibility updates through to to
// the chrome side when this result is set visible/invisible.
bool notify_visibility_change;
};
// All possible states of the app list.
enum AppListState {
kStateApps = 0,
kStateSearchResults,
kStateStart_DEPRECATED,
kStateEmbeddedAssistant,
};
// The status of the app list model.
enum AppListModelStatus {
kStatusNormal,
kStatusSyncing, // Syncing apps or installing synced apps.
};
// The UI component the user launched the search result from. Must match
// chrome/browser/ui/app_list/app_launch_event_logger.proto.
// This enum is used in a histogram, do not remove/renumber entries. If you're
// adding to this enum with the intention that it will be logged, update the
// AppListLaunchedFrom enum listing in tools/metrics/histograms/enums.xml.
enum AppListLaunchedFrom {
kLaunchedFromGrid = 1,
kLaunchedFromSuggestionChip = 2,
kLaunchedFromShelf = 3,
kLaunchedFromSearchBox = 4,
};
// The UI representation of the search result. Currently all search results
// that are not apps (OminboxResult, LauncherSearcResult, etc.) are grouped
// into kSearchResult. Meanwhile SearchResultTileItemView (shown in zero state)
// and suggested chips are considered kAppSearchResult.
enum AppListLaunchType {
kSearchResult = 0,
kAppSearchResult,
};
// How the result should be displayed. Do not change the order of these as
// they are used for metrics.
enum SearchResultDisplayType {
kNone = 0,
kList,
kTile,
kRecommendation,
kCard,
// Add new values here.
};
// Type of the search result, which is set in Chrome.
enum SearchResultType {
kInstalledApp, // Installed apps.
kPlayStoreApp, // Installable apps from PlayStore.
kInstantApp, // Instant apps.
kInternalApp, // Chrome OS apps.
kOmnibox, // Results from Omninbox.
kLauncher, // Results from launcher search (currently only from Files).
kAnswerCard, // WebContents based answer card.
kPlayStoreReinstallApp, // Reinstall recommendations from PlayStore.
kArcAppShortcut, // ARC++ app shortcuts.
// Add new values here.
};
// A tagged range in search result text.
struct SearchResultTag {
// Similar to ACMatchClassification::Style, the style values are not
// mutually exclusive.
int16 styles;
gfx.mojom.Range range;
};
// Data representing an action that can be performed on a search result.
// An action could be represented as an image button, it will be always visibe
// if |visible_on_hover| is false; otherwise how it is visible only when
// when its associated search result is hovered.
struct SearchResultAction {
mojo_base.mojom.String16 tooltip_text;
gfx.mojom.ImageSkia image;
bool visible_on_hover;
};