OLD | NEW |
(Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // Multiply-included message file, hence no traditional include guard. |
| 6 |
| 7 #include <vector> |
| 8 |
| 9 #include "base/string16.h" |
| 10 #include "chrome/common/instant_types.h" |
| 11 #include "chrome/common/omnibox_types.h" |
| 12 #include "content/public/common/page_transition_types.h" |
| 13 #include "googleurl/src/gurl.h" |
| 14 #include "ipc/ipc_message_macros.h" |
| 15 #include "ui/base/window_open_disposition.h" |
| 16 #include "ui/gfx/rect.h" |
| 17 |
| 18 #define IPC_MESSAGE_START InstantMsgStart |
| 19 |
| 20 IPC_ENUM_TRAITS(InstantCompleteBehavior) |
| 21 IPC_ENUM_TRAITS(InstantSizeUnits) |
| 22 IPC_ENUM_TRAITS(InstantSuggestionType) |
| 23 IPC_ENUM_TRAITS(OmniboxFocusState) |
| 24 IPC_ENUM_TRAITS(ThemeBackgroundImageAlignment) |
| 25 IPC_ENUM_TRAITS(ThemeBackgroundImageTiling) |
| 26 |
| 27 IPC_STRUCT_TRAITS_BEGIN(InstantAutocompleteResult) |
| 28 IPC_STRUCT_TRAITS_MEMBER(provider) |
| 29 IPC_STRUCT_TRAITS_MEMBER(type) |
| 30 IPC_STRUCT_TRAITS_MEMBER(description) |
| 31 IPC_STRUCT_TRAITS_MEMBER(destination_url) |
| 32 IPC_STRUCT_TRAITS_MEMBER(transition) |
| 33 IPC_STRUCT_TRAITS_MEMBER(relevance) |
| 34 IPC_STRUCT_TRAITS_END() |
| 35 |
| 36 IPC_STRUCT_TRAITS_BEGIN(InstantSuggestion) |
| 37 IPC_STRUCT_TRAITS_MEMBER(text) |
| 38 IPC_STRUCT_TRAITS_MEMBER(behavior) |
| 39 IPC_STRUCT_TRAITS_MEMBER(type) |
| 40 IPC_STRUCT_TRAITS_END() |
| 41 |
| 42 IPC_STRUCT_TRAITS_BEGIN(MostVisitedItem) |
| 43 IPC_STRUCT_TRAITS_MEMBER(url) |
| 44 IPC_STRUCT_TRAITS_MEMBER(title) |
| 45 IPC_STRUCT_TRAITS_END() |
| 46 |
| 47 IPC_STRUCT_TRAITS_BEGIN(ThemeBackgroundInfo) |
| 48 IPC_STRUCT_TRAITS_MEMBER(color_r) |
| 49 IPC_STRUCT_TRAITS_MEMBER(color_g) |
| 50 IPC_STRUCT_TRAITS_MEMBER(color_b) |
| 51 IPC_STRUCT_TRAITS_MEMBER(color_a) |
| 52 IPC_STRUCT_TRAITS_MEMBER(theme_id) |
| 53 IPC_STRUCT_TRAITS_MEMBER(image_horizontal_alignment) |
| 54 IPC_STRUCT_TRAITS_MEMBER(image_vertical_alignment) |
| 55 IPC_STRUCT_TRAITS_MEMBER(image_tiling) |
| 56 IPC_STRUCT_TRAITS_MEMBER(image_height) |
| 57 IPC_STRUCT_TRAITS_END() |
| 58 |
| 59 // ----------------------------------------- |
| 60 // Messages from the browser to the renderer |
| 61 // ----------------------------------------- |
| 62 |
| 63 // Requests the renderer to determine if the page supports the searchbox API. |
| 64 // Usually sent whenever the browser notices that the page has navigated. The |
| 65 // reply is sent in ChromeViewHostMsg_SearchBoxInstantSupportDetermined. The |
| 66 // browser uses the response to decide whether to continue using the page as |
| 67 // an Instant preview. |
| 68 IPC_MESSAGE_ROUTED0(ChromeViewMsg_SearchBoxDetermineInstantSupport) |
| 69 |
| 70 // Notifies the renderer that the omnibox contents have changed. The page uses |
| 71 // this to fetch and show suggestions and/or preview results for the query. |
| 72 // If verbatim is true, the page predicts the query the user meant to type and |
| 73 // fetches results for the prediction. If verbatim is false, the query is taken |
| 74 // literally (no prediction is made). |
| 75 IPC_MESSAGE_ROUTED4(ChromeViewMsg_SearchBoxChange, |
| 76 string16 /* query */, |
| 77 bool /* verbatim */, |
| 78 size_t /* selection_start */, |
| 79 size_t /* selection_end */) |
| 80 |
| 81 // Notifies the renderer that the user hit Enter in the omnibox. The page uses |
| 82 // this to know that the user "committed" the query. |
| 83 IPC_MESSAGE_ROUTED1(ChromeViewMsg_SearchBoxSubmit, |
| 84 string16 /* query */) |
| 85 |
| 86 // Informs the renderer about newly available autocomplete results. The page |
| 87 // takes these into account when presenting a list of suggestions. |
| 88 IPC_MESSAGE_ROUTED1(ChromeViewMsg_SearchBoxAutocompleteResults, |
| 89 std::vector<InstantAutocompleteResult> /* results */) |
| 90 |
| 91 // Requests the page to select an entry in its suggestions list, |count| items |
| 92 // away from the currently selected entry (positive to move down the list, |
| 93 // negative to move up). |
| 94 IPC_MESSAGE_ROUTED1(ChromeViewMsg_SearchBoxSelect, |
| 95 int /* count */) |
| 96 |
| 97 // Notifies the renderer that the user hit Escape after having arrowed down in |
| 98 // the suggestions list, thus cancelling the selection. The omnibox has |
| 99 // reverted to the given query. The page should reset the selection to the |
| 100 // first suggestion in its list. |
| 101 IPC_MESSAGE_ROUTED1(ChromeViewMsg_SearchBoxCancel, |
| 102 string16 /* query */) |
| 103 |
| 104 // Notifies the renderer that the omnibox lost focus, because the user clicked |
| 105 // on the Instant overlay. The page uses this to know that the user implicitly |
| 106 // accepted the query by interacting with the overlay. |
| 107 // TODO(sreeram): Only used in v1 API. Remove when v1 is no longer supported. |
| 108 IPC_MESSAGE_ROUTED1(ChromeViewMsg_SearchBoxBlur, |
| 109 string16 /* query */) |
| 110 |
| 111 // Notifies the renderer that the size of the omnibox popup has changed. The |
| 112 // page uses this to offset its results so that they don't overlap the popup. |
| 113 // TODO(sreeram): Only used in v1 API. Remove when v1 is no longer supported. |
| 114 IPC_MESSAGE_ROUTED1(ChromeViewMsg_SearchBoxPopupBounds, |
| 115 gfx::Rect /* bounds */) |
| 116 |
| 117 // Informs the renderer about the omnibox bounds. The page uses this to align |
| 118 // its suggestions with the omnibox. |
| 119 IPC_MESSAGE_ROUTED1(ChromeViewMsg_SearchBoxOmniboxBounds, |
| 120 gfx::Rect /* bounds */) |
| 121 |
| 122 // Notifies the renderer whether the omnibox is capturing key strokes (i.e., |
| 123 // even if it appears to not have focus). |
| 124 IPC_MESSAGE_ROUTED1(ChromeViewMsg_SearchBoxKeyCaptureChanged, |
| 125 bool /* is_key_capture_enabled */) |
| 126 |
| 127 // Informs the renderer whether the user prefers to see results preview or just |
| 128 // suggestions. The page should respect this preference, but it isn't enforced. |
| 129 IPC_MESSAGE_ROUTED1(ChromeViewMsg_SearchBoxDisplayInstantResults, |
| 130 bool /* display_instant_results */) |
| 131 |
| 132 // Informs the renderer about a custom theme the user has installed. The page |
| 133 // uses this to match its background to the theme. |
| 134 IPC_MESSAGE_ROUTED1(ChromeViewMsg_SearchBoxThemeChanged, |
| 135 ThemeBackgroundInfo /* theme_info */) |
| 136 |
| 137 // Informs the renderer of the font and size of the omnibox text. The page uses |
| 138 // this to render its suggestions in the same font and size. |
| 139 IPC_MESSAGE_ROUTED2(ChromeViewMsg_SearchBoxFontChanged, |
| 140 string16 /* font_name */, |
| 141 size_t /* font_size */) |
| 142 |
| 143 // Informs the renderer about newly available most visited items. The page |
| 144 // shows these when in NTP (New Tab Page) mode. |
| 145 IPC_MESSAGE_ROUTED1(ChromeViewMsg_SearchBoxMostVisitedItems, |
| 146 std::vector<MostVisitedItem> /* items */) |
| 147 |
| 148 // Informs the renderer that the page should be allowed to access and request |
| 149 // resources from the chrome-search:// scheme. |
| 150 IPC_MESSAGE_ROUTED1(ChromeViewMsg_SearchBoxGrantChromeSearchAccessFromOrigin, |
| 151 GURL /* origin_url */) |
| 152 |
| 153 // ----------------------------------------- |
| 154 // Messages from the renderer to the browser |
| 155 // ----------------------------------------- |
| 156 |
| 157 // Informs the browser of whether the page supports the searchbox API. |
| 158 IPC_MESSAGE_ROUTED2(ChromeViewHostMsg_SearchBoxInstantSupportDetermined, |
| 159 int /* page_id */, |
| 160 bool /* supports_instant */) |
| 161 |
| 162 // Informs the browser of an available query completion. |
| 163 IPC_MESSAGE_ROUTED2(ChromeViewHostMsg_SearchBoxSetSuggestion, |
| 164 int /* page_id */, |
| 165 InstantSuggestion /* suggestion */) |
| 166 |
| 167 // Requests the browser to initiate a navigation to the given URL. This is |
| 168 // required since the page can't navigate to privileged destinations (such as |
| 169 // chrome:// URLs) or history URLs (which are hidden from the page using |
| 170 // restricted IDs) on its own. |
| 171 IPC_MESSAGE_ROUTED4(ChromeViewHostMsg_SearchBoxNavigateToURL, |
| 172 int /* page_id */, |
| 173 GURL /* url */, |
| 174 content::PageTransition /* transition */, |
| 175 WindowOpenDisposition /* disposition */) |
| 176 |
| 177 // Requests the browser to show the page as an Instant overlay. |
| 178 IPC_MESSAGE_ROUTED3(ChromeViewHostMsg_SearchBoxShowOverlay, |
| 179 int /* page_id */, |
| 180 int /* height */, |
| 181 InstantSizeUnits /* height_units */) |
| 182 |
| 183 // Requests the omnibox to be focused visibly, invisibly or not at all. |
| 184 IPC_MESSAGE_ROUTED2(ChromeViewHostMsg_SearchBoxSetFocusState, |
| 185 int /* page_id */, |
| 186 OmniboxFocusState /* focus_state */) |
| 187 |
| 188 // Requests the browser to delete a URL from the most visited list. The page |
| 189 // sends this when the user clicks the "x" on a most visited item on the page. |
| 190 IPC_MESSAGE_ROUTED2(ChromeViewHostMsg_SearchBoxDeleteMostVisitedItem, |
| 191 int /* page_id */, |
| 192 GURL /* url */) |
| 193 |
| 194 // Requests the browser to undo deletion of a URL from the most visited list. |
| 195 // The page sends this when the user changes their mind after deleting the URL |
| 196 // from the most visited list. |
| 197 IPC_MESSAGE_ROUTED2(ChromeViewHostMsg_SearchBoxUndoMostVisitedItemDeletion, |
| 198 int /* page_id */, |
| 199 GURL /* url */) |
| 200 |
| 201 // Requests the browser to undo all URL deletions from the most visited list. |
| 202 IPC_MESSAGE_ROUTED1(ChromeViewHostMsg_SearchBoxUndoAllMostVisitedItemDeletions, |
| 203 int /* page_id */) |
OLD | NEW |