diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-22 20:45:02 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-22 20:45:02 +0000 |
commit | 2c556966fd9de58860ac4d0a81f893affd2c45cc (patch) | |
tree | 6664904c144c4b857246cd91378f8364b18e57bc /content/common | |
parent | c8240b1c3519b35de243b0fb91af409d59a5808c (diff) | |
download | chromium_src-2c556966fd9de58860ac4d0a81f893affd2c45cc.zip chromium_src-2c556966fd9de58860ac4d0a81f893affd2c45cc.tar.gz chromium_src-2c556966fd9de58860ac4d0a81f893affd2c45cc.tar.bz2 |
Move a bunch more renderer messages from chrome to content.
TBR=tsepez
Review URL: http://codereview.chromium.org/6726004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79031 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/common')
-rw-r--r-- | content/common/view_messages.h | 239 |
1 files changed, 239 insertions, 0 deletions
diff --git a/content/common/view_messages.h b/content/common/view_messages.h index c18c223..a6c9461 100644 --- a/content/common/view_messages.h +++ b/content/common/view_messages.h @@ -8,19 +8,70 @@ #include "content/common/common_param_traits.h" #include "content/common/css_colors.h" #include "content/common/edit_command.h" +#include "content/common/page_transition_types.h" +#include "content/common/page_zoom.h" #include "content/common/renderer_preferences.h" #include "ipc/ipc_message_macros.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebFindOptions.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerAction.h" #include "ui/gfx/rect.h" #include "webkit/glue/context_menu.h" #include "webkit/glue/webmenuitem.h" #include "webkit/glue/webpreferences.h" +// Define enums used in this file inside an include-guard. +#ifndef CONTENT_COMMON_VIEW_MESSAGES_H_ +#define CONTENT_COMMON_VIEW_MESSAGES_H_ + +class ViewMsg_Navigate_Type { + public: + enum Value { + // Reload the page. + RELOAD, + + // Reload the page, ignoring any cache entries. + RELOAD_IGNORING_CACHE, + + // The navigation is the result of session restore and should honor the + // page's cache policy while restoring form state. This is set to true if + // restoring a tab/session from the previous session and the previous + // session did not crash. If this is not set and the page was restored then + // the page's cache policy is ignored and we load from the cache. + RESTORE, + + // Speculatively prerendering the page. + PRERENDER, + + // Navigation type not categorized by the other types. + NORMAL + }; +}; + +// The user has completed a find-in-page; this type defines what actions the +// renderer should take next. +struct ViewMsg_StopFinding_Params { + enum Action { + kClearSelection, + kKeepSelection, + kActivateSelection + }; + + ViewMsg_StopFinding_Params() : action(kClearSelection) {} + + // The action that should be taken when the find is completed. + Action action; +}; + +#endif // CONTENT_COMMON_VIEW_MESSAGES_H_ + #define IPC_MESSAGE_START ViewMsgStart IPC_ENUM_TRAITS(CSSColors::CSSColorName) +IPC_ENUM_TRAITS(PageZoom::Function) IPC_ENUM_TRAITS(RendererPreferencesHintingEnum) IPC_ENUM_TRAITS(RendererPreferencesSubpixelRenderingEnum) +IPC_ENUM_TRAITS(ViewMsg_Navigate_Type::Value) +IPC_ENUM_TRAITS(ViewMsg_StopFinding_Params::Action) IPC_ENUM_TRAITS(WebKit::WebContextMenuData::MediaType) IPC_ENUM_TRAITS(WebKit::WebMediaPlayerAction::Type) IPC_ENUM_TRAITS(WebMenuItem::Type) @@ -47,6 +98,16 @@ IPC_STRUCT_TRAITS_BEGIN(RendererPreferences) IPC_STRUCT_TRAITS_MEMBER(caret_blink_interval) IPC_STRUCT_TRAITS_END() +IPC_STRUCT_TRAITS_BEGIN(ViewMsg_StopFinding_Params) + IPC_STRUCT_TRAITS_MEMBER(action) +IPC_STRUCT_TRAITS_END() + +IPC_STRUCT_TRAITS_BEGIN(WebKit::WebFindOptions) + IPC_STRUCT_TRAITS_MEMBER(forward) + IPC_STRUCT_TRAITS_MEMBER(matchCase) + IPC_STRUCT_TRAITS_MEMBER(findNext) +IPC_STRUCT_TRAITS_END() + IPC_STRUCT_TRAITS_BEGIN(WebKit::WebMediaPlayerAction) IPC_STRUCT_TRAITS_MEMBER(type) IPC_STRUCT_TRAITS_MEMBER(enable) @@ -156,6 +217,47 @@ IPC_STRUCT_TRAITS_BEGIN(ContextMenuParams) IPC_STRUCT_TRAITS_MEMBER(custom_items) IPC_STRUCT_TRAITS_END() +IPC_STRUCT_BEGIN(ViewMsg_Navigate_Params) + // The page_id for this navigation, or -1 if it is a new navigation. Back, + // Forward, and Reload navigations should have a valid page_id. If the load + // succeeds, then this page_id will be reflected in the resultant + // ViewHostMsg_FrameNavigate message. + IPC_STRUCT_MEMBER(int32, page_id) + + // If page_id is -1, then pending_history_list_offset will also be -1. + // Otherwise, it contains the offset into the history list corresponding to + // the current navigation. + IPC_STRUCT_MEMBER(int, pending_history_list_offset) + + // Informs the RenderView of where its current page contents reside in + // session history and the total size of the session history list. + IPC_STRUCT_MEMBER(int, current_history_list_offset) + IPC_STRUCT_MEMBER(int, current_history_list_length) + + // The URL to load. + IPC_STRUCT_MEMBER(GURL, url) + + // The URL to send in the "Referer" header field. Can be empty if there is + // no referrer. + // TODO: consider folding this into extra_headers. + IPC_STRUCT_MEMBER(GURL, referrer) + + // The type of transition. + IPC_STRUCT_MEMBER(PageTransition::Type, transition) + + // Opaque history state (received by ViewHostMsg_UpdateState). + IPC_STRUCT_MEMBER(std::string, state) + + // Type of navigation. + IPC_STRUCT_MEMBER(ViewMsg_Navigate_Type::Value, navigation_type) + + // The time the request was created + IPC_STRUCT_MEMBER(base::Time, request_time) + + // Extra headers (separated by \n) to send during the request. + IPC_STRUCT_MEMBER(std::string, extra_headers) +IPC_STRUCT_END() + // This message is used for supporting popup menus on Mac OS X using native // Cocoa controls. The renderer sends us this message which we use to populate // the popup menu. @@ -334,12 +436,128 @@ IPC_MESSAGE_ROUTED2(ViewMsg_CustomContextMenuAction, IPC_MESSAGE_ROUTED1(ViewMsg_ContextMenuClosed, webkit_glue::CustomContextMenuContext /* custom_context */) +// Tells the renderer to perform the specified navigation, interrupting any +// existing navigation. +IPC_MESSAGE_ROUTED1(ViewMsg_Navigate, ViewMsg_Navigate_Params) + +IPC_MESSAGE_ROUTED0(ViewMsg_Stop) + +// Tells the renderer to reload the current focused frame +IPC_MESSAGE_ROUTED0(ViewMsg_ReloadFrame) + +// Sent when the user wants to search for a word on the page (find in page). +IPC_MESSAGE_ROUTED3(ViewMsg_Find, + int /* request_id */, + string16 /* search_text */, + WebKit::WebFindOptions) + +// This message notifies the renderer that the user has closed the FindInPage +// window (and what action to take regarding the selection). +IPC_MESSAGE_ROUTED1(ViewMsg_StopFinding, + ViewMsg_StopFinding_Params /* action */) + +// Used to notify the render-view that the browser has received a reply for +// the Find operation and is interested in receiving the next one. This is +// used to prevent the renderer from spamming the browser process with +// results. +IPC_MESSAGE_ROUTED0(ViewMsg_FindReplyACK) + +// These messages are typically generated from context menus and request the +// renderer to apply the specified operation to the current selection. +IPC_MESSAGE_ROUTED0(ViewMsg_Undo) +IPC_MESSAGE_ROUTED0(ViewMsg_Redo) +IPC_MESSAGE_ROUTED0(ViewMsg_Cut) +IPC_MESSAGE_ROUTED0(ViewMsg_Copy) +#if defined(OS_MACOSX) +IPC_MESSAGE_ROUTED0(ViewMsg_CopyToFindPboard) +#endif +IPC_MESSAGE_ROUTED0(ViewMsg_Paste) +// Replaces the selected region or a word around the cursor with the +// specified string. +IPC_MESSAGE_ROUTED1(ViewMsg_Replace, + string16) +IPC_MESSAGE_ROUTED0(ViewMsg_Delete) +IPC_MESSAGE_ROUTED0(ViewMsg_SelectAll) + +// Copies the image at location x, y to the clipboard (if there indeed is an +// image at that location). +IPC_MESSAGE_ROUTED2(ViewMsg_CopyImageAt, + int /* x */, + int /* y */) + // Tells the renderer to perform the given action on the media player // located at the given point. IPC_MESSAGE_ROUTED2(ViewMsg_MediaPlayerActionAt, gfx::Point, /* location */ WebKit::WebMediaPlayerAction) +// Request for the renderer to evaluate an xpath to a frame and execute a +// javascript: url in that frame's context. The message is completely +// asynchronous and no corresponding response message is sent back. +// +// frame_xpath contains the modified xpath notation to identify an inner +// subframe (starting from the root frame). It is a concatenation of +// number of smaller xpaths delimited by '\n'. Each chunk in the string can +// be evaluated to a frame in its parent-frame's context. +// +// Example: /html/body/iframe/\n/html/body/div/iframe/\n/frameset/frame[0] +// can be broken into 3 xpaths +// /html/body/iframe evaluates to an iframe within the root frame +// /html/body/div/iframe evaluates to an iframe within the level-1 iframe +// /frameset/frame[0] evaluates to first frame within the level-2 iframe +// +// jscript_url is the string containing the javascript: url to be executed +// in the target frame's context. The string should start with "javascript:" +// and continue with a valid JS text. +// +// If the fourth parameter is true the result is sent back to the renderer +// using the message ViewHostMsg_ScriptEvalResponse. +// ViewHostMsg_ScriptEvalResponse is passed the ID parameter so that the +// client can uniquely identify the request. +IPC_MESSAGE_ROUTED4(ViewMsg_ScriptEvalRequest, + string16, /* frame_xpath */ + string16, /* jscript_url */ + int, /* ID */ + bool /* If true, result is sent back. */) + +// Request for the renderer to evaluate an xpath to a frame and insert css +// into that frame's document. See ViewMsg_ScriptEvalRequest for details on +// allowed xpath expressions. +IPC_MESSAGE_ROUTED3(ViewMsg_CSSInsertRequest, + std::wstring, /* frame_xpath */ + std::string, /* css string */ + std::string /* element id */) + +// External popup menus. +IPC_MESSAGE_ROUTED1(ViewMsg_SelectPopupMenuItem, + int /* selected index, -1 means no selection */) + +// Change the zoom level for the current main frame. If the level actually +// changes, a ViewHostMsg_DidZoomURL message will be sent back to the browser +// telling it what url got zoomed and what its current zoom level is. +IPC_MESSAGE_ROUTED1(ViewMsg_Zoom, + PageZoom::Function /* function */) + +// Set the zoom level for the current main frame. If the level actually +// changes, a ViewHostMsg_DidZoomURL message will be sent back to the browser +// telling it what url got zoomed and what its current zoom level is. +IPC_MESSAGE_ROUTED1(ViewMsg_SetZoomLevel, + double /* zoom_level */) + +// Set the zoom level for a particular url that the renderer is in the +// process of loading. This will be stored, to be used if the load commits +// and ignored otherwise. +IPC_MESSAGE_ROUTED2(ViewMsg_SetZoomLevelForLoadingURL, + GURL /* url */, + double /* zoom_level */) + +// Set the zoom level for a particular url, so all render views +// displaying this url can update their zoom levels to match. +IPC_MESSAGE_CONTROL2(ViewMsg_SetZoomLevelForCurrentURL, + GURL /* url */, + double /* zoom_level */) + + // Messages sent from the renderer to the browser. @@ -352,3 +570,24 @@ IPC_MESSAGE_ROUTED1(ViewHostMsg_ContextMenu, ContextMenuParams) // Message to show a popup menu using native cocoa controls (Mac only). IPC_MESSAGE_ROUTED1(ViewHostMsg_ShowPopup, ViewHostMsg_ShowPopup_Params) + +// Response from ViewMsg_ScriptEvalRequest. The ID is the parameter supplied +// to ViewMsg_ScriptEvalRequest. The result has the value returned by the +// script as it's only element, one of Null, Boolean, Integer, Real, Date, or +// String. +IPC_MESSAGE_ROUTED2(ViewHostMsg_ScriptEvalResponse, + int /* id */, + ListValue /* result */) + +// Result of string search in the page. +// Response to ViewMsg_Find with the results of the requested find-in-page +// search, the number of matches found and the selection rect (in screen +// coordinates) for the string found. If |final_update| is false, it signals +// that this is not the last Find_Reply message - more will be sent as the +// scoping effort continues. +IPC_MESSAGE_ROUTED5(ViewHostMsg_Find_Reply, + int /* request_id */, + int /* number of matches */, + gfx::Rect /* selection_rect */, + int /* active_match_ordinal */, + bool /* final_update */) |