| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2011 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 #ifndef WEBKIT_GLUE_CONTEXT_MENU_H_ | |
| 6 #define WEBKIT_GLUE_CONTEXT_MENU_H_ | |
| 7 | |
| 8 #include <vector> | |
| 9 | |
| 10 #include "base/basictypes.h" | |
| 11 #include "base/string16.h" | |
| 12 #include "googleurl/src/gurl.h" | |
| 13 #include "webkit/glue/webkit_glue_export.h" | |
| 14 #include "webkit/glue/webmenuitem.h" | |
| 15 | |
| 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h" | |
| 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebReferrerPolicy.h" | |
| 18 | |
| 19 namespace webkit_glue { | |
| 20 | |
| 21 struct CustomContextMenuContext { | |
| 22 bool is_pepper_menu; | |
| 23 int request_id; | |
| 24 // The routing ID of the render widget on which the context menu is shown. | |
| 25 // It could also be |kCurrentRenderWidget|, which means the render widget that | |
| 26 // the corresponding ViewHostMsg_ContextMenu is sent to. | |
| 27 int32 render_widget_id; | |
| 28 WEBKIT_GLUE_EXPORT static const int32 kCurrentRenderWidget; | |
| 29 | |
| 30 WEBKIT_GLUE_EXPORT CustomContextMenuContext(); | |
| 31 }; | |
| 32 | |
| 33 } // namespace webkit_glue | |
| 34 | |
| 35 // TODO(viettrungluu): Put this in the webkit_glue namespace. | |
| 36 // Parameters structure for ViewHostMsg_ContextMenu. | |
| 37 // FIXME(beng): This would be more useful in the future and more efficient | |
| 38 // if the parameters here weren't so literally mapped to what | |
| 39 // they contain for the ContextMenu task. It might be better | |
| 40 // to make the string fields more generic so that this object | |
| 41 // could be used for more contextual actions. | |
| 42 struct WEBKIT_GLUE_EXPORT ContextMenuParams { | |
| 43 // This is the type of Context Node that the context menu was invoked on. | |
| 44 WebKit::WebContextMenuData::MediaType media_type; | |
| 45 | |
| 46 // These values represent the coordinates of the mouse when the context menu | |
| 47 // was invoked. Coords are relative to the associated RenderView's origin. | |
| 48 int x; | |
| 49 int y; | |
| 50 | |
| 51 // This is the URL of the link that encloses the node the context menu was | |
| 52 // invoked on. | |
| 53 GURL link_url; | |
| 54 | |
| 55 // The link URL to be used ONLY for "copy link address". We don't validate | |
| 56 // this field in the frontend process. | |
| 57 GURL unfiltered_link_url; | |
| 58 | |
| 59 // This is the source URL for the element that the context menu was | |
| 60 // invoked on. Example of elements with source URLs are img, audio, and | |
| 61 // video. | |
| 62 GURL src_url; | |
| 63 | |
| 64 // This is true if the context menu was invoked on a blocked image. | |
| 65 bool is_image_blocked; | |
| 66 | |
| 67 // This is the URL of the top level page that the context menu was invoked | |
| 68 // on. | |
| 69 GURL page_url; | |
| 70 | |
| 71 // This is the absolute keyword search URL including the %s search tag when | |
| 72 // the "Add as search engine..." option is clicked (left empty if not used). | |
| 73 GURL keyword_url; | |
| 74 | |
| 75 // This is the URL of the subframe that the context menu was invoked on. | |
| 76 GURL frame_url; | |
| 77 | |
| 78 // This is the ID of the subframe that the context menu was invoked on. | |
| 79 int64 frame_id; | |
| 80 | |
| 81 // This is the history item state of the subframe that the context menu was | |
| 82 // invoked on. | |
| 83 std::string frame_content_state; | |
| 84 | |
| 85 // These are the parameters for the media element that the context menu | |
| 86 // was invoked on. | |
| 87 int media_flags; | |
| 88 | |
| 89 // This is the text of the selection that the context menu was invoked on. | |
| 90 string16 selection_text; | |
| 91 | |
| 92 // The misspelled word under the cursor, if any. Used to generate the | |
| 93 // |dictionary_suggestions| list. | |
| 94 string16 misspelled_word; | |
| 95 | |
| 96 // Suggested replacements for a misspelled word under the cursor. | |
| 97 // This vector gets populated in the render process host | |
| 98 // by intercepting ViewHostMsg_ContextMenu in ResourceMessageFilter | |
| 99 // and populating dictionary_suggestions if the type is EDITABLE | |
| 100 // and the misspelled_word is not empty. | |
| 101 std::vector<string16> dictionary_suggestions; | |
| 102 | |
| 103 // If editable, flag for whether node is speech-input enabled. | |
| 104 bool speech_input_enabled; | |
| 105 | |
| 106 // If editable, flag for whether spell check is enabled or not. | |
| 107 bool spellcheck_enabled; | |
| 108 | |
| 109 // Whether context is editable. | |
| 110 bool is_editable; | |
| 111 | |
| 112 #if defined(OS_MACOSX) | |
| 113 // Writing direction menu items. | |
| 114 // Currently only used on OS X. | |
| 115 int writing_direction_default; | |
| 116 int writing_direction_left_to_right; | |
| 117 int writing_direction_right_to_left; | |
| 118 #endif // OS_MACOSX | |
| 119 | |
| 120 // These flags indicate to the browser whether the renderer believes it is | |
| 121 // able to perform the corresponding action. | |
| 122 int edit_flags; | |
| 123 | |
| 124 // The security info for the resource we are showing the menu on. | |
| 125 std::string security_info; | |
| 126 | |
| 127 // The character encoding of the frame on which the menu is invoked. | |
| 128 std::string frame_charset; | |
| 129 | |
| 130 // The referrer policy of the frame on which the menu is invoked. | |
| 131 WebKit::WebReferrerPolicy referrer_policy; | |
| 132 | |
| 133 webkit_glue::CustomContextMenuContext custom_context; | |
| 134 std::vector<WebMenuItem> custom_items; | |
| 135 | |
| 136 ContextMenuParams(); | |
| 137 ContextMenuParams(const WebKit::WebContextMenuData& data); | |
| 138 ~ContextMenuParams(); | |
| 139 }; | |
| 140 | |
| 141 #endif // WEBKIT_GLUE_CONTEXT_MENU_H_ | |
| OLD | NEW |