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