summaryrefslogtreecommitdiff
path: root/chromium/chrome/common/instant.mojom
blob: 287c846952e17417423ecd3180087c87aa7e8e23 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
// Copyright 2016 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 chrome.mojom;

import "mojo/common/string16.mojom";
import "mojo/common/time.mojom";
import "url/mojo/url.mojom";

[Native]
enum NTPLoggingEventType;

[Native]
enum OmniboxFocusState;

[Native]
enum NTPTileSource;

// 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. |instant| 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(associated Instant& instant, associated SearchBox client);
};

// TODO(tibell): Rename this to EmbeddedSearch.
//
// Browser interface to support embedded search. Render frames connect to this
// interface to query browser data, such as the most visited pages.
interface Instant {
  // Tells InstantExtended whether the embedded search API is supported.
  // See http://dev.chromium.org/embeddedsearch
  InstantSupportDetermined(int32 page_seq_no, bool result);

  // Tells InstantExtended to set the omnibox focus state.
  FocusOmnibox(int32 page_seq_no, OmniboxFocusState state);

  // 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);

  // Logs events from InstantExtended New Tab Pages.
  LogEvent(int32 page_seq_no,
           NTPLoggingEventType event,
           mojo.common.mojom.TimeDelta time);

  // Logs an impression on one of the Most Visited tile on the InstantExtended
  // New Tab Page.
  LogMostVisitedImpression(int32 page_seq_no, int32 position,
                           NTPTileSource tile_source);

  // Logs a navigation on one of the Most Visited tile on the InstantExtended
  // New Tab Page.
  LogMostVisitedNavigation(int32 page_seq_no, int32 position,
                           NTPTileSource tile_source);

  // Tells InstantExtended to paste text into the omnibox.  If text is empty,
  // the clipboard contents will be pasted. This causes the omnibox dropdown to
  // open.
  PasteAndOpenDropdown(int32 page_seq_no,
                       mojo.common.mojom.String16 text_to_be_pasted);

  // The Instant page asks whether the user syncs its history.
  HistorySyncCheck(int32 page_seq_no);

  // The Instant page asks for Chrome identity check against |identity|.
  ChromeIdentityCheck(int32 page_seq_no, mojo.common.mojom.String16 identity);
};

[Native]
enum OmniboxFocusChangeReason;

[Native]
struct InstantMostVisitedItem;

[Native]
struct InstantSuggestion;

[Native]
struct EmbeddedSearchRequestParams;

[Native]
struct ThemeBackgroundInfo;

// TODO(tibell): Rename this to EmbeddedSearchClient.
//
// 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 SearchBox {
  SetPageSequenceNumber(int32 page_seq_no);

  DetermineIfPageSupportsInstant();

  FocusChanged(OmniboxFocusState new_focus_state,
               OmniboxFocusChangeReason reason);

  MostVisitedChanged(array<InstantMostVisitedItem> items);

  SetInputInProgress(bool input_in_progress);

  SetSuggestionToPrefetch(InstantSuggestion suggestion);

  Submit(mojo.common.mojom.String16 value,
         EmbeddedSearchRequestParams params);

  ThemeChanged(ThemeBackgroundInfo value);

  // TODO(treib): Remove the *Result methods and instead add return values to
  // the correspnding methods in the Instant interface above.
  HistorySyncCheckResult(bool sync_history);

  ChromeIdentityCheckResult(mojo.common.mojom.String16 identity,
                            bool identity_match);
};