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// IPC messages for interacting with frames.
6// Multiply-included message file, hence no include guard.
7
8#include "content/common/content_export.h"
9#include "content/common/content_param_traits.h"
10#include "content/common/frame_message_enums.h"
11#include "content/common/frame_param.h"
12#include "content/common/navigation_gesture.h"
13#include "content/common/resource_request_body.h"
14#include "content/public/common/color_suggestion.h"
15#include "content/public/common/common_param_traits.h"
16#include "content/public/common/context_menu_params.h"
17#include "content/public/common/frame_navigate_params.h"
18#include "content/public/common/javascript_message_type.h"
19#include "content/public/common/page_state.h"
20#include "ipc/ipc_message_macros.h"
21#include "ui/gfx/ipc/gfx_param_traits.h"
22#include "url/gurl.h"
23
24#undef IPC_MESSAGE_EXPORT
25#define IPC_MESSAGE_EXPORT CONTENT_EXPORT
26
27#define IPC_MESSAGE_START FrameMsgStart
28
29IPC_ENUM_TRAITS_MIN_MAX_VALUE(AccessibilityMode,
30                              AccessibilityModeOff,
31                              AccessibilityModeComplete)
32IPC_ENUM_TRAITS_MIN_MAX_VALUE(content::JavaScriptMessageType,
33                              content::JAVASCRIPT_MESSAGE_TYPE_ALERT,
34                              content::JAVASCRIPT_MESSAGE_TYPE_PROMPT)
35IPC_ENUM_TRAITS_MAX_VALUE(FrameMsg_Navigate_Type::Value,
36                          FrameMsg_Navigate_Type::NAVIGATE_TYPE_LAST)
37IPC_ENUM_TRAITS_MAX_VALUE(blink::WebContextMenuData::MediaType,
38                          blink::WebContextMenuData::MediaTypeLast)
39IPC_ENUM_TRAITS_MAX_VALUE(ui::MenuSourceType, ui::MENU_SOURCE_TYPE_LAST)
40
41IPC_STRUCT_TRAITS_BEGIN(content::ColorSuggestion)
42  IPC_STRUCT_TRAITS_MEMBER(color)
43  IPC_STRUCT_TRAITS_MEMBER(label)
44IPC_STRUCT_TRAITS_END()
45
46IPC_STRUCT_TRAITS_BEGIN(content::ContextMenuParams)
47  IPC_STRUCT_TRAITS_MEMBER(media_type)
48  IPC_STRUCT_TRAITS_MEMBER(x)
49  IPC_STRUCT_TRAITS_MEMBER(y)
50  IPC_STRUCT_TRAITS_MEMBER(link_url)
51  IPC_STRUCT_TRAITS_MEMBER(link_text)
52  IPC_STRUCT_TRAITS_MEMBER(unfiltered_link_url)
53  IPC_STRUCT_TRAITS_MEMBER(src_url)
54  IPC_STRUCT_TRAITS_MEMBER(has_image_contents)
55  IPC_STRUCT_TRAITS_MEMBER(page_url)
56  IPC_STRUCT_TRAITS_MEMBER(keyword_url)
57  IPC_STRUCT_TRAITS_MEMBER(frame_url)
58  IPC_STRUCT_TRAITS_MEMBER(frame_page_state)
59  IPC_STRUCT_TRAITS_MEMBER(media_flags)
60  IPC_STRUCT_TRAITS_MEMBER(selection_text)
61  IPC_STRUCT_TRAITS_MEMBER(suggested_filename)
62  IPC_STRUCT_TRAITS_MEMBER(misspelled_word)
63  IPC_STRUCT_TRAITS_MEMBER(misspelling_hash)
64  IPC_STRUCT_TRAITS_MEMBER(dictionary_suggestions)
65  IPC_STRUCT_TRAITS_MEMBER(spellcheck_enabled)
66  IPC_STRUCT_TRAITS_MEMBER(is_editable)
67  IPC_STRUCT_TRAITS_MEMBER(writing_direction_default)
68  IPC_STRUCT_TRAITS_MEMBER(writing_direction_left_to_right)
69  IPC_STRUCT_TRAITS_MEMBER(writing_direction_right_to_left)
70  IPC_STRUCT_TRAITS_MEMBER(edit_flags)
71  IPC_STRUCT_TRAITS_MEMBER(security_info)
72  IPC_STRUCT_TRAITS_MEMBER(frame_charset)
73  IPC_STRUCT_TRAITS_MEMBER(referrer_policy)
74  IPC_STRUCT_TRAITS_MEMBER(custom_context)
75  IPC_STRUCT_TRAITS_MEMBER(custom_items)
76  IPC_STRUCT_TRAITS_MEMBER(source_type)
77#if defined(OS_ANDROID)
78  IPC_STRUCT_TRAITS_MEMBER(selection_start)
79  IPC_STRUCT_TRAITS_MEMBER(selection_end)
80#endif
81IPC_STRUCT_TRAITS_END()
82
83IPC_STRUCT_TRAITS_BEGIN(content::CustomContextMenuContext)
84  IPC_STRUCT_TRAITS_MEMBER(is_pepper_menu)
85  IPC_STRUCT_TRAITS_MEMBER(request_id)
86  IPC_STRUCT_TRAITS_MEMBER(render_widget_id)
87  IPC_STRUCT_TRAITS_MEMBER(link_followed)
88IPC_STRUCT_TRAITS_END()
89
90IPC_STRUCT_BEGIN(FrameHostMsg_DidFailProvisionalLoadWithError_Params)
91  // Error code as reported in the DidFailProvisionalLoad callback.
92  IPC_STRUCT_MEMBER(int, error_code)
93  // An error message generated from the error_code. This can be an empty
94  // string if we were unable to find a meaningful description.
95  IPC_STRUCT_MEMBER(base::string16, error_description)
96  // The URL that the error is reported for.
97  IPC_STRUCT_MEMBER(GURL, url)
98  // True if the failure is the result of navigating to a POST again
99  // and we're going to show the POST interstitial.
100  IPC_STRUCT_MEMBER(bool, showing_repost_interstitial)
101IPC_STRUCT_END()
102
103IPC_STRUCT_TRAITS_BEGIN(content::FrameNavigateParams)
104  IPC_STRUCT_TRAITS_MEMBER(page_id)
105  IPC_STRUCT_TRAITS_MEMBER(url)
106  IPC_STRUCT_TRAITS_MEMBER(base_url)
107  IPC_STRUCT_TRAITS_MEMBER(referrer)
108  IPC_STRUCT_TRAITS_MEMBER(transition)
109  IPC_STRUCT_TRAITS_MEMBER(redirects)
110  IPC_STRUCT_TRAITS_MEMBER(should_update_history)
111  IPC_STRUCT_TRAITS_MEMBER(searchable_form_url)
112  IPC_STRUCT_TRAITS_MEMBER(searchable_form_encoding)
113  IPC_STRUCT_TRAITS_MEMBER(contents_mime_type)
114  IPC_STRUCT_TRAITS_MEMBER(socket_address)
115IPC_STRUCT_TRAITS_END()
116
117// Parameters structure for FrameHostMsg_DidCommitProvisionalLoad, which has
118// too many data parameters to be reasonably put in a predefined IPC message.
119IPC_STRUCT_BEGIN_WITH_PARENT(FrameHostMsg_DidCommitProvisionalLoad_Params,
120                             content::FrameNavigateParams)
121  IPC_STRUCT_TRAITS_PARENT(content::FrameNavigateParams)
122
123  // Information regarding the security of the connection (empty if the
124  // connection was not secure).
125  IPC_STRUCT_MEMBER(std::string, security_info)
126
127  // The gesture that initiated this navigation.
128  IPC_STRUCT_MEMBER(content::NavigationGesture, gesture)
129
130  // True if this was a post request.
131  IPC_STRUCT_MEMBER(bool, is_post)
132
133  // The POST body identifier. -1 if it doesn't exist.
134  IPC_STRUCT_MEMBER(int64, post_id)
135
136  // Whether the frame navigation resulted in no change to the documents within
137  // the page. For example, the navigation may have just resulted in scrolling
138  // to a named anchor.
139  IPC_STRUCT_MEMBER(bool, was_within_same_page)
140
141  // The status code of the HTTP request.
142  IPC_STRUCT_MEMBER(int, http_status_code)
143
144  // This flag is used to warn if the renderer is displaying an error page,
145  // so that we can set the appropriate page type.
146  IPC_STRUCT_MEMBER(bool, url_is_unreachable)
147
148  // True if the connection was proxied.  In this case, socket_address
149  // will represent the address of the proxy, rather than the remote host.
150  IPC_STRUCT_MEMBER(bool, was_fetched_via_proxy)
151
152  // Serialized history item state to store in the navigation entry.
153  IPC_STRUCT_MEMBER(content::PageState, page_state)
154
155  // Original request's URL.
156  IPC_STRUCT_MEMBER(GURL, original_request_url)
157
158  // User agent override used to navigate.
159  IPC_STRUCT_MEMBER(bool, is_overriding_user_agent)
160
161  // Notifies the browser that for this navigation, the session history was
162  // successfully cleared.
163  IPC_STRUCT_MEMBER(bool, history_list_was_cleared)
164
165  // The routing_id of the render view associated with the navigation.
166  // We need to track the RenderViewHost routing_id because of downstream
167  // dependencies (crbug.com/392171 DownloadRequestHandle, SaveFileManager,
168  // ResourceDispatcherHostImpl, MediaStreamUIProxy,
169  // SpeechRecognitionDispatcherHost and possibly others). They look up the view
170  // based on the ID stored in the resource requests. Once those dependencies
171  // are unwound or moved to RenderFrameHost (crbug.com/304341) we can move the
172  // client to be based on the routing_id of the RenderFrameHost.
173  IPC_STRUCT_MEMBER(int, render_view_routing_id)
174IPC_STRUCT_END()
175
176IPC_STRUCT_BEGIN(FrameMsg_Navigate_Params)
177  // The page_id for this navigation, or -1 if it is a new navigation.  Back,
178  // Forward, and Reload navigations should have a valid page_id.  If the load
179  // succeeds, then this page_id will be reflected in the resultant
180  // FrameHostMsg_DidCommitProvisionalLoad message.
181  IPC_STRUCT_MEMBER(int32, page_id)
182
183  // If page_id is -1, then pending_history_list_offset will also be -1.
184  // Otherwise, it contains the offset into the history list corresponding to
185  // the current navigation.
186  IPC_STRUCT_MEMBER(int, pending_history_list_offset)
187
188  // Informs the RenderView of where its current page contents reside in
189  // session history and the total size of the session history list.
190  IPC_STRUCT_MEMBER(int, current_history_list_offset)
191  IPC_STRUCT_MEMBER(int, current_history_list_length)
192
193  // Informs the RenderView the session history should be cleared. In that
194  // case, the RenderView needs to notify the browser that the clearing was
195  // succesful when the navigation commits.
196  IPC_STRUCT_MEMBER(bool, should_clear_history_list)
197
198  // The URL to load.
199  IPC_STRUCT_MEMBER(GURL, url)
200
201  // Base URL for use in WebKit's SubstituteData.
202  // Is only used with data: URLs.
203  IPC_STRUCT_MEMBER(GURL, base_url_for_data_url)
204
205  // History URL for use in WebKit's SubstituteData.
206  // Is only used with data: URLs.
207  IPC_STRUCT_MEMBER(GURL, history_url_for_data_url)
208
209  // The URL to send in the "Referer" header field. Can be empty if there is
210  // no referrer.
211  IPC_STRUCT_MEMBER(content::Referrer, referrer)
212
213  // Any redirect URLs that occurred before |url|. Useful for cross-process
214  // navigations; defaults to empty.
215  IPC_STRUCT_MEMBER(std::vector<GURL>, redirects)
216
217  // The type of transition.
218  IPC_STRUCT_MEMBER(ui::PageTransition, transition)
219
220  // Informs the RenderView the pending navigation should replace the current
221  // history entry when it commits. This is used for cross-process redirects so
222  // the transferred navigation can recover the navigation state.
223  IPC_STRUCT_MEMBER(bool, should_replace_current_entry)
224
225  // Opaque history state (received by ViewHostMsg_UpdateState).
226  IPC_STRUCT_MEMBER(content::PageState, page_state)
227
228  // Type of navigation.
229  IPC_STRUCT_MEMBER(FrameMsg_Navigate_Type::Value, navigation_type)
230
231  // The time the request was created. This is used by the old performance
232  // infrastructure to set up DocumentState associated with the RenderView.
233  // TODO(ppi): make it go away.
234  IPC_STRUCT_MEMBER(base::Time, request_time)
235
236  // Extra headers (separated by \n) to send during the request.
237  IPC_STRUCT_MEMBER(std::string, extra_headers)
238
239  // The following two members identify a previous request that has been
240  // created before this navigation is being transferred to a new render view.
241  // This serves the purpose of recycling the old request.
242  // Unless this refers to a transferred navigation, these values are -1 and -1.
243  IPC_STRUCT_MEMBER(int, transferred_request_child_id)
244  IPC_STRUCT_MEMBER(int, transferred_request_request_id)
245
246  // Whether or not we should allow the url to download.
247  IPC_STRUCT_MEMBER(bool, allow_download)
248
249  // Whether or not the user agent override string should be used.
250  IPC_STRUCT_MEMBER(bool, is_overriding_user_agent)
251
252  // True if this was a post request.
253  IPC_STRUCT_MEMBER(bool, is_post)
254
255  // If is_post is true, holds the post_data information from browser. Empty
256  // otherwise.
257  IPC_STRUCT_MEMBER(std::vector<unsigned char>, browser_initiated_post_data)
258
259  // Whether or not this url should be allowed to access local file://
260  // resources.
261  IPC_STRUCT_MEMBER(bool, can_load_local_resources)
262
263  // If not empty, which frame to navigate.
264  IPC_STRUCT_MEMBER(std::string, frame_to_navigate)
265
266  // The navigationStart time to expose through the Navigation Timing API to JS.
267  IPC_STRUCT_MEMBER(base::TimeTicks, browser_navigation_start)
268IPC_STRUCT_END()
269
270IPC_STRUCT_BEGIN(FrameHostMsg_OpenURL_Params)
271  IPC_STRUCT_MEMBER(GURL, url)
272  IPC_STRUCT_MEMBER(content::Referrer, referrer)
273  IPC_STRUCT_MEMBER(WindowOpenDisposition, disposition)
274  IPC_STRUCT_MEMBER(bool, should_replace_current_entry)
275  IPC_STRUCT_MEMBER(bool, user_gesture)
276IPC_STRUCT_END()
277
278// PlzNavigate
279IPC_STRUCT_BEGIN(FrameHostMsg_BeginNavigation_Params)
280  // The request method: GET, POST, etc.
281  IPC_STRUCT_MEMBER(std::string, method)
282
283  // The requested URL.
284  IPC_STRUCT_MEMBER(GURL, url)
285
286  // The referrer to use (may be empty).
287  IPC_STRUCT_MEMBER(content::Referrer, referrer)
288
289  // Additional HTTP request headers.
290  IPC_STRUCT_MEMBER(std::string, headers)
291
292  // net::URLRequest load flags (net::LOAD_NORMAL) by default).
293  IPC_STRUCT_MEMBER(int, load_flags)
294
295  // Optional resource request body (may be null).
296  IPC_STRUCT_MEMBER(scoped_refptr<content::ResourceRequestBody>,
297                    request_body)
298
299  // True if the request was user initiated.
300  IPC_STRUCT_MEMBER(bool, has_user_gesture)
301
302  IPC_STRUCT_MEMBER(ui::PageTransition, transition_type)
303
304  // Whether this navigation should replace the current session history entry on
305  // commit.
306  IPC_STRUCT_MEMBER(bool, should_replace_current_entry)
307
308  // Whether or not we should allow the URL to download.
309  IPC_STRUCT_MEMBER(bool, allow_download)
310IPC_STRUCT_END()
311
312#if defined(OS_MACOSX) || defined(OS_ANDROID)
313// This message is used for supporting popup menus on Mac OS X and Android using
314// native controls. See the FrameHostMsg_ShowPopup message.
315IPC_STRUCT_BEGIN(FrameHostMsg_ShowPopup_Params)
316  // Position on the screen.
317  IPC_STRUCT_MEMBER(gfx::Rect, bounds)
318
319  // The height of each item in the menu.
320  IPC_STRUCT_MEMBER(int, item_height)
321
322  // The size of the font to use for those items.
323  IPC_STRUCT_MEMBER(double, item_font_size)
324
325  // The currently selected (displayed) item in the menu.
326  IPC_STRUCT_MEMBER(int, selected_item)
327
328  // The entire list of items in the popup menu.
329  IPC_STRUCT_MEMBER(std::vector<content::MenuItem>, popup_items)
330
331  // Whether items should be right-aligned.
332  IPC_STRUCT_MEMBER(bool, right_aligned)
333
334  // Whether this is a multi-select popup.
335  IPC_STRUCT_MEMBER(bool, allow_multiple_selection)
336IPC_STRUCT_END()
337#endif
338
339// -----------------------------------------------------------------------------
340// Messages sent from the browser to the renderer.
341
342// Notifies the embedding frame that a new CompositorFrame is ready to be
343// presented. When the frame finishes presenting, a matching
344// FrameHostMsg_CompositorFrameSwappedACK should be sent back to the
345// RenderViewHost that was produced the CompositorFrame.
346//
347// This is used in the ubercomp compositing path.
348IPC_MESSAGE_ROUTED1(FrameMsg_CompositorFrameSwapped,
349                    FrameMsg_CompositorFrameSwapped_Params /* params */)
350
351// Notifies the embedding frame that the process rendering the child frame's
352// contents has terminated.
353IPC_MESSAGE_ROUTED0(FrameMsg_ChildFrameProcessGone)
354
355// Sent in response to a FrameHostMsg_ContextMenu to let the renderer know that
356// the menu has been closed.
357IPC_MESSAGE_ROUTED1(FrameMsg_ContextMenuClosed,
358                    content::CustomContextMenuContext /* custom_context */)
359
360// Executes custom context menu action that was provided from Blink.
361IPC_MESSAGE_ROUTED2(FrameMsg_CustomContextMenuAction,
362                    content::CustomContextMenuContext /* custom_context */,
363                    unsigned /* action */)
364
365// Requests that the RenderFrame or RenderFrameProxy sets its opener to null.
366IPC_MESSAGE_ROUTED0(FrameMsg_DisownOpener)
367
368// Instructs the renderer to create a new RenderFrame object with |routing_id|.
369// The new frame should be created as a child of the object identified by
370// |parent_routing_id| or as top level if that is MSG_ROUTING_NONE.
371IPC_MESSAGE_CONTROL2(FrameMsg_NewFrame,
372                     int /* routing_id */,
373                     int /* parent_routing_id */)
374
375// Instructs the renderer to create a new RenderFrameProxy object with
376// |routing_id|. The new proxy should be created as a child of the object
377// identified by |parent_routing_id| or as top level if that is
378// MSG_ROUTING_NONE.
379IPC_MESSAGE_CONTROL3(FrameMsg_NewFrameProxy,
380                     int /* routing_id */,
381                     int /* parent_routing_id */,
382                     int /* render_view_routing_id */)
383
384// Tells the renderer to perform the specified navigation, interrupting any
385// existing navigation.
386IPC_MESSAGE_ROUTED1(FrameMsg_Navigate, FrameMsg_Navigate_Params)
387
388// Instructs the renderer to invoke the frame's beforeunload event handler.
389// Expects the result to be returned via FrameHostMsg_BeforeUnload_ACK.
390IPC_MESSAGE_ROUTED0(FrameMsg_BeforeUnload)
391
392// Instructs the frame to swap out for a cross-site transition, including
393// running the unload event handler and creating a RenderFrameProxy with the
394// given |proxy_routing_id|. Expects a SwapOut_ACK message when finished.
395IPC_MESSAGE_ROUTED1(FrameMsg_SwapOut,
396                    int /* proxy_routing_id */)
397
398// Instructs the frame to stop the load in progress, if any.
399IPC_MESSAGE_ROUTED0(FrameMsg_Stop)
400
401// Request for the renderer to insert CSS into the frame.
402IPC_MESSAGE_ROUTED1(FrameMsg_CSSInsertRequest,
403                    std::string  /* css */)
404
405// Request for the renderer to execute JavaScript in the frame's context.
406//
407// javascript is the string containing the JavaScript to be executed in the
408// target frame's context.
409//
410// If the third parameter is true the result is sent back to the browser using
411// the message FrameHostMsg_JavaScriptExecuteResponse.
412// FrameHostMsg_JavaScriptExecuteResponse is passed the ID parameter so that the
413// host can uniquely identify the request.
414IPC_MESSAGE_ROUTED3(FrameMsg_JavaScriptExecuteRequest,
415                    base::string16,  /* javascript */
416                    int,  /* ID */
417                    bool  /* if true, a reply is requested */)
418
419// ONLY FOR TESTS: Same as above but adds a fake UserGestureindicator around
420// execution. (crbug.com/408426)
421IPC_MESSAGE_ROUTED3(FrameMsg_JavaScriptExecuteRequestForTests,
422                    base::string16,  /* javascript */
423                    int,  /* ID */
424                    bool  /* if true, a reply is requested */)
425
426// Selects between the given start and end offsets in the currently focused
427// editable field.
428IPC_MESSAGE_ROUTED2(FrameMsg_SetEditableSelectionOffsets,
429                    int /* start */,
430                    int /* end */)
431
432// Requests a navigation to the supplied markup, in an iframe with sandbox
433// attributes.
434IPC_MESSAGE_ROUTED1(FrameMsg_SetupTransitionView,
435                    std::string /* markup */)
436
437// Tells the renderer to hide the elements specified by the supplied CSS
438// selector, and activates any exiting-transition stylesheets.
439IPC_MESSAGE_ROUTED1(FrameMsg_BeginExitTransition,
440                    std::string /* css_selector */)
441
442// Tells the renderer to reload the frame, optionally ignoring the cache while
443// doing so.
444IPC_MESSAGE_ROUTED1(FrameMsg_Reload,
445                    bool /* ignore_cache */)
446
447// Notifies the color chooser client that the user selected a color.
448IPC_MESSAGE_ROUTED2(FrameMsg_DidChooseColorResponse, unsigned, SkColor)
449
450// Notifies the color chooser client that the color chooser has ended.
451IPC_MESSAGE_ROUTED1(FrameMsg_DidEndColorChooser, unsigned)
452
453// Notifies the corresponding RenderFrameProxy object to replace itself with the
454// RenderFrame object it is associated with.
455IPC_MESSAGE_ROUTED0(FrameMsg_DeleteProxy)
456
457// Request the text surrounding the selection with a |max_length|. The response
458// will be sent via FrameHostMsg_TextSurroundingSelectionResponse.
459IPC_MESSAGE_ROUTED1(FrameMsg_TextSurroundingSelectionRequest,
460                    size_t /* max_length */)
461
462// Tells the renderer to insert a link to the specified stylesheet. This is
463// needed to support navigation transitions.
464IPC_MESSAGE_ROUTED1(FrameMsg_AddStyleSheetByURL, std::string)
465
466// Change the accessibility mode in the renderer process.
467IPC_MESSAGE_ROUTED1(FrameMsg_SetAccessibilityMode,
468                    AccessibilityMode)
469
470#if defined(OS_ANDROID)
471
472// External popup menus.
473IPC_MESSAGE_ROUTED2(FrameMsg_SelectPopupMenuItems,
474                    bool /* user canceled the popup */,
475                    std::vector<int> /* selected indices */)
476
477#elif defined(OS_MACOSX)
478
479// External popup menus.
480IPC_MESSAGE_ROUTED1(FrameMsg_SelectPopupMenuItem,
481                    int /* selected index, -1 means no selection */)
482
483#endif
484
485// -----------------------------------------------------------------------------
486// Messages sent from the renderer to the browser.
487
488// Blink and JavaScript error messages to log to the console
489// or debugger UI.
490IPC_MESSAGE_ROUTED4(FrameHostMsg_AddMessageToConsole,
491                    int32, /* log level */
492                    base::string16, /* msg */
493                    int32, /* line number */
494                    base::string16 /* source id */ )
495
496// Sent by the renderer when a child frame is created in the renderer.
497//
498// Each of these messages will have a corresponding FrameHostMsg_Detach message
499// sent when the frame is detached from the DOM.
500IPC_SYNC_MESSAGE_CONTROL2_1(FrameHostMsg_CreateChildFrame,
501                            int32 /* parent_routing_id */,
502                            std::string /* frame_name */,
503                            int32 /* new_routing_id */)
504
505// Sent by the renderer to the parent RenderFrameHost when a child frame is
506// detached from the DOM.
507IPC_MESSAGE_ROUTED0(FrameHostMsg_Detach)
508
509// Sent by the renderer when the frame becomes focused.
510IPC_MESSAGE_ROUTED0(FrameHostMsg_FrameFocused)
511
512// Sent when the renderer starts a provisional load for a frame.
513// |is_transition_navigation| signals that the frame has defined transition
514// elements which can be animated by the navigation destination to provide
515// a transition effect during load.
516IPC_MESSAGE_ROUTED2(FrameHostMsg_DidStartProvisionalLoadForFrame,
517                    GURL /* url */,
518                    bool /* is_transition_navigation */)
519
520// Sent when the renderer fails a provisional load with an error.
521IPC_MESSAGE_ROUTED1(FrameHostMsg_DidFailProvisionalLoadWithError,
522                    FrameHostMsg_DidFailProvisionalLoadWithError_Params)
523
524// Notifies the browser that a frame in the view has changed. This message
525// has a lot of parameters and is packed/unpacked by functions defined in
526// render_messages.h.
527IPC_MESSAGE_ROUTED1(FrameHostMsg_DidCommitProvisionalLoad,
528                    FrameHostMsg_DidCommitProvisionalLoad_Params)
529
530// Notifies the browser that a document has been loaded.
531IPC_MESSAGE_ROUTED0(FrameHostMsg_DidFinishDocumentLoad)
532
533IPC_MESSAGE_ROUTED3(FrameHostMsg_DidFailLoadWithError,
534                    GURL /* validated_url */,
535                    int /* error_code */,
536                    base::string16 /* error_description */)
537
538// Sent when the renderer starts loading the page. |to_different_document| will
539// be true unless the load is a fragment navigation, or triggered by
540// history.pushState/replaceState.
541IPC_MESSAGE_ROUTED1(FrameHostMsg_DidStartLoading,
542                    bool /* to_different_document */)
543
544// Sent when the renderer is done loading a page.
545IPC_MESSAGE_ROUTED0(FrameHostMsg_DidStopLoading)
546
547// Sent when the renderer changed the progress of a load.
548IPC_MESSAGE_ROUTED1(FrameHostMsg_DidChangeLoadProgress,
549                    double /* load_progress */)
550
551// Requests that the given URL be opened in the specified manner.
552IPC_MESSAGE_ROUTED1(FrameHostMsg_OpenURL, FrameHostMsg_OpenURL_Params)
553
554// Notifies the browser that a frame finished loading.
555IPC_MESSAGE_ROUTED1(FrameHostMsg_DidFinishLoad,
556                    GURL /* validated_url */)
557
558// Sent when after the onload handler has been invoked for the document
559// in this frame. Sent for top-level frames.
560IPC_MESSAGE_ROUTED0(FrameHostMsg_DocumentOnLoadCompleted)
561
562// Notifies that the initial empty document of a view has been accessed.
563// After this, it is no longer safe to show a pending navigation's URL without
564// making a URL spoof possible.
565IPC_MESSAGE_ROUTED0(FrameHostMsg_DidAccessInitialDocument)
566
567// Sent when the frame sets its opener to null, disowning it for the lifetime of
568// the window. Sent for top-level frames.
569IPC_MESSAGE_ROUTED0(FrameHostMsg_DidDisownOpener)
570
571// Notifies the browser that a page id was assigned.
572IPC_MESSAGE_ROUTED1(FrameHostMsg_DidAssignPageId,
573                    int32 /* page_id */)
574
575// Changes the title for the page in the UI when the page is navigated or the
576// title changes. Sent for top-level frames.
577IPC_MESSAGE_ROUTED3(FrameHostMsg_UpdateTitle,
578                    int32 /* page_id */,
579                    base::string16 /* title */,
580                    blink::WebTextDirection /* title direction */)
581
582// Change the encoding name of the page in UI when the page has detected
583// proper encoding name. Sent for top-level frames.
584IPC_MESSAGE_ROUTED1(FrameHostMsg_UpdateEncoding,
585                    std::string /* new encoding name */)
586
587// Following message is used to communicate the values received by the
588// callback binding the JS to Cpp.
589// An instance of browser that has an automation host listening to it can
590// have a javascript send a native value (string, number, boolean) to the
591// listener in Cpp. (DomAutomationController)
592IPC_MESSAGE_ROUTED2(FrameHostMsg_DomOperationResponse,
593                    std::string  /* json_string */,
594                    int  /* automation_id */)
595
596// Sent to the browser when the renderer detects it is blocked on a pepper
597// plugin message for too long. This is also sent when it becomes unhung
598// (according to the value of is_hung). The browser can give the user the
599// option of killing the plugin.
600IPC_MESSAGE_ROUTED3(FrameHostMsg_PepperPluginHung,
601                    int /* plugin_child_id */,
602                    base::FilePath /* path */,
603                    bool /* is_hung */)
604
605// Sent by the renderer process to indicate that a plugin instance has crashed.
606// Note: |plugin_pid| should not be trusted. The corresponding process has
607// probably died. Moreover, the ID may have been reused by a new process. Any
608// usage other than displaying it in a prompt to the user is very likely to be
609// wrong.
610IPC_MESSAGE_ROUTED2(FrameHostMsg_PluginCrashed,
611                    base::FilePath /* plugin_path */,
612                    base::ProcessId /* plugin_pid */)
613
614// Return information about a plugin for the given URL and MIME
615// type. If there is no matching plugin, |found| is false.
616// |actual_mime_type| is the actual mime type supported by the
617// found plugin.
618IPC_SYNC_MESSAGE_CONTROL4_3(FrameHostMsg_GetPluginInfo,
619                            int /* render_frame_id */,
620                            GURL /* url */,
621                            GURL /* page_url */,
622                            std::string /* mime_type */,
623                            bool /* found */,
624                            content::WebPluginInfo /* plugin info */,
625                            std::string /* actual_mime_type */)
626
627// A renderer sends this to the browser process when it wants to
628// create a plugin.  The browser will create the plugin process if
629// necessary, and will return a handle to the channel on success.
630// On error an empty string is returned.
631IPC_SYNC_MESSAGE_CONTROL4_2(FrameHostMsg_OpenChannelToPlugin,
632                            int /* render_frame_id */,
633                            GURL /* url */,
634                            GURL /* page_url */,
635                            std::string /* mime_type */,
636                            IPC::ChannelHandle /* channel_handle */,
637                            content::WebPluginInfo /* info */)
638
639// Acknowledge that we presented an ubercomp frame.
640//
641// See FrameMsg_CompositorFrameSwapped
642IPC_MESSAGE_ROUTED1(FrameHostMsg_CompositorFrameSwappedACK,
643                    FrameHostMsg_CompositorFrameSwappedACK_Params /* params */)
644
645// Provides the result from handling BeforeUnload.  |proceed| matches the return
646// value of the frame's beforeunload handler: true if the user decided to
647// proceed with leaving the page.
648IPC_MESSAGE_ROUTED3(FrameHostMsg_BeforeUnload_ACK,
649                    bool /* proceed */,
650                    base::TimeTicks /* before_unload_start_time */,
651                    base::TimeTicks /* before_unload_end_time */)
652
653// Indicates that the current frame has swapped out, after a SwapOut message.
654IPC_MESSAGE_ROUTED0(FrameHostMsg_SwapOut_ACK)
655
656IPC_MESSAGE_ROUTED1(FrameHostMsg_ReclaimCompositorResources,
657                    FrameHostMsg_ReclaimCompositorResources_Params /* params */)
658
659// Forwards an input event to a child.
660// TODO(nick): Temporary bridge, revisit once the browser process can route
661// input directly to subframes. http://crbug.com/339659
662IPC_MESSAGE_ROUTED1(FrameHostMsg_ForwardInputEvent,
663                    IPC::WebInputEventPointer /* event */)
664
665// Used to tell the parent that the user right clicked on an area of the
666// content area, and a context menu should be shown for it. The params
667// object contains information about the node(s) that were selected when the
668// user right clicked.
669IPC_MESSAGE_ROUTED1(FrameHostMsg_ContextMenu, content::ContextMenuParams)
670
671// Initial drawing parameters for a child frame that has been swapped out to
672// another process.
673IPC_MESSAGE_ROUTED2(FrameHostMsg_InitializeChildFrame,
674                    gfx::Rect /* frame_rect */,
675                    float /* scale_factor */)
676
677// Response for FrameMsg_JavaScriptExecuteRequest, sent when a reply was
678// requested. The ID is the parameter supplied to
679// FrameMsg_JavaScriptExecuteRequest. The result has the value returned by the
680// script as its only element, one of Null, Boolean, Integer, Real, Date, or
681// String.
682IPC_MESSAGE_ROUTED2(FrameHostMsg_JavaScriptExecuteResponse,
683                    int  /* id */,
684                    base::ListValue  /* result */)
685
686// A request to run a JavaScript dialog.
687IPC_SYNC_MESSAGE_ROUTED4_2(FrameHostMsg_RunJavaScriptMessage,
688                           base::string16     /* in - alert message */,
689                           base::string16     /* in - default prompt */,
690                           GURL               /* in - originating page URL */,
691                           content::JavaScriptMessageType /* in - type */,
692                           bool               /* out - success */,
693                           base::string16     /* out - user_input field */)
694
695// Displays a dialog to confirm that the user wants to navigate away from the
696// page. Replies true if yes, and false otherwise. The reply string is ignored,
697// but is included so that we can use OnJavaScriptMessageBoxClosed.
698IPC_SYNC_MESSAGE_ROUTED3_2(FrameHostMsg_RunBeforeUnloadConfirm,
699                           GURL,           /* in - originating frame URL */
700                           base::string16  /* in - alert message */,
701                           bool            /* in - is a reload */,
702                           bool            /* out - success */,
703                           base::string16  /* out - This is ignored.*/)
704
705// Asks the browser to open the color chooser.
706IPC_MESSAGE_ROUTED3(FrameHostMsg_OpenColorChooser,
707                    int /* id */,
708                    SkColor /* color */,
709                    std::vector<content::ColorSuggestion> /* suggestions */)
710
711// Asks the browser to end the color chooser.
712IPC_MESSAGE_ROUTED1(FrameHostMsg_EndColorChooser, int /* id */)
713
714// Change the selected color in the color chooser.
715IPC_MESSAGE_ROUTED2(FrameHostMsg_SetSelectedColorInColorChooser,
716                    int /* id */,
717                    SkColor /* color */)
718
719// Notifies the browser that media has started/stopped playing.
720IPC_MESSAGE_ROUTED4(FrameHostMsg_MediaPlayingNotification,
721                    int64 /* player_cookie, distinguishes instances */,
722                    bool /* has_video */,
723                    bool /* has_audio */,
724                    bool /* is_remote */)
725
726IPC_MESSAGE_ROUTED1(FrameHostMsg_MediaPausedNotification,
727                    int64 /* player_cookie, distinguishes instances */)
728
729// Notify browser the theme color has been changed.
730IPC_MESSAGE_ROUTED1(FrameHostMsg_DidChangeThemeColor,
731                    SkColor /* theme_color */)
732
733// Response for FrameMsg_TextSurroundingSelectionRequest, |startOffset| and
734// |endOffset| are the offsets of the selection in the returned |content|.
735IPC_MESSAGE_ROUTED3(FrameHostMsg_TextSurroundingSelectionResponse,
736                    base::string16,  /* content */
737                    size_t, /* startOffset */
738                    size_t /* endOffset */)
739
740// Notifies the browser that the renderer has a pending navigation transition.
741// The string parameters are all UTF8.
742IPC_MESSAGE_CONTROL4(FrameHostMsg_AddNavigationTransitionData,
743                     int /* render_frame_id */,
744                     std::string  /* allowed_destination_host_pattern */,
745                     std::string  /* selector */,
746                     std::string  /* markup */)
747
748// Tells the browser to perform a navigation.
749IPC_MESSAGE_ROUTED1(FrameHostMsg_BeginNavigation,
750                    FrameHostMsg_BeginNavigation_Params)
751
752// Sent once a paint happens after the first non empty layout. In other words
753// after the frame has painted something.
754IPC_MESSAGE_ROUTED0(FrameHostMsg_DidFirstVisuallyNonEmptyPaint)
755
756#if defined(OS_MACOSX) || defined(OS_ANDROID)
757
758// Message to show/hide a popup menu using native controls.
759IPC_MESSAGE_ROUTED1(FrameHostMsg_ShowPopup,
760                    FrameHostMsg_ShowPopup_Params)
761IPC_MESSAGE_ROUTED0(FrameHostMsg_HidePopup)
762
763#endif
764