Removing uses of X11 native key events.
[chromium-blink-merge.git] / content / public / common / context_menu_params.h
blob8849dae303d29f4677075080dd1a289698103a22
1 // Copyright (c) 2012 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.
5 #ifndef CONTENT_PUBLIC_COMMON_CONTEXT_MENU_PARAMS_H_
6 #define CONTENT_PUBLIC_COMMON_CONTEXT_MENU_PARAMS_H_
8 #include <string>
9 #include <vector>
11 #include "base/basictypes.h"
12 #include "base/strings/string16.h"
13 #include "content/common/content_export.h"
14 #include "content/public/common/menu_item.h"
15 #include "content/public/common/page_state.h"
16 #include "content/public/common/ssl_status.h"
17 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h"
18 #include "third_party/WebKit/public/web/WebContextMenuData.h"
19 #include "ui/base/ui_base_types.h"
20 #include "url/gurl.h"
22 #if defined(OS_ANDROID)
23 #include "ui/gfx/point.h"
24 #endif
26 namespace content {
28 struct CONTENT_EXPORT CustomContextMenuContext {
29 static const int32 kCurrentRenderWidget;
31 CustomContextMenuContext();
33 bool is_pepper_menu;
34 int request_id;
35 // The routing ID of the render widget on which the context menu is shown.
36 // It could also be |kCurrentRenderWidget|, which means the render widget that
37 // the corresponding ViewHostMsg_ContextMenu is sent to.
38 int32 render_widget_id;
40 // If the context menu was created for a link, and we navigated to that url,
41 // this will contain the url that was navigated. This field may not be set
42 // if, for example, we are transitioning to an incognito window, since we
43 // want to sever any connection to the old renderer.
44 GURL link_followed;
47 // FIXME(beng): This would be more useful in the future and more efficient
48 // if the parameters here weren't so literally mapped to what
49 // they contain for the ContextMenu task. It might be better
50 // to make the string fields more generic so that this object
51 // could be used for more contextual actions.
52 struct CONTENT_EXPORT ContextMenuParams {
53 ContextMenuParams();
54 ~ContextMenuParams();
56 // This is the type of Context Node that the context menu was invoked on.
57 blink::WebContextMenuData::MediaType media_type;
59 // These values represent the coordinates of the mouse when the context menu
60 // was invoked. Coords are relative to the associated RenderView's origin.
61 int x;
62 int y;
64 // This is the URL of the link that encloses the node the context menu was
65 // invoked on.
66 GURL link_url;
68 // The text associated with the link. May be an empty string if the contents
69 // of the link are an image.
70 // Will be empty if link_url is empty.
71 base::string16 link_text;
73 // The link URL to be used ONLY for "copy link address". We don't validate
74 // this field in the frontend process.
75 GURL unfiltered_link_url;
77 // This is the source URL for the element that the context menu was
78 // invoked on. Example of elements with source URLs are img, audio, and
79 // video.
80 GURL src_url;
82 // This is true if the context menu was invoked on an image which has
83 // non-empty contents.
84 bool has_image_contents;
86 // This is the URL of the top level page that the context menu was invoked
87 // on.
88 GURL page_url;
90 // This is the absolute keyword search URL including the %s search tag when
91 // the "Add as search engine..." option is clicked (left empty if not used).
92 GURL keyword_url;
94 // This is the URL of the subframe that the context menu was invoked on.
95 GURL frame_url;
97 // This is the page state of the frame on which the context menu was invoked.
98 PageState frame_page_state;
100 // These are the parameters for the media element that the context menu
101 // was invoked on.
102 int media_flags;
104 // This is the text of the selection that the context menu was invoked on.
105 base::string16 selection_text;
107 // This is the suggested filename to be used when saving file through "Save
108 // Link As" option of context menu.
109 base::string16 suggested_filename;
111 // The misspelled word under the cursor, if any. Used to generate the
112 // |dictionary_suggestions| list.
113 base::string16 misspelled_word;
115 // The identifier of the misspelling under the cursor, if any.
116 uint32 misspelling_hash;
118 // Suggested replacements for a misspelled word under the cursor.
119 // This vector gets populated in the render process host
120 // by intercepting ViewHostMsg_ContextMenu in ResourceMessageFilter
121 // and populating dictionary_suggestions if the type is EDITABLE
122 // and the misspelled_word is not empty.
123 std::vector<base::string16> dictionary_suggestions;
125 // If editable, flag for whether spell check is enabled or not.
126 bool spellcheck_enabled;
128 // Whether context is editable.
129 bool is_editable;
131 // Writing direction menu items.
132 int writing_direction_default;
133 int writing_direction_left_to_right;
134 int writing_direction_right_to_left;
136 // These flags indicate to the browser whether the renderer believes it is
137 // able to perform the corresponding action.
138 int edit_flags;
140 // The security info for the resource we are showing the menu on.
141 SSLStatus security_info;
143 // The character encoding of the frame on which the menu is invoked.
144 std::string frame_charset;
146 // The referrer policy of the frame on which the menu is invoked.
147 blink::WebReferrerPolicy referrer_policy;
149 CustomContextMenuContext custom_context;
150 std::vector<MenuItem> custom_items;
152 ui::MenuSourceType source_type;
154 #if defined(OS_ANDROID)
155 // Points representing the coordinates in the document space of the start and
156 // end of the selection, if there is one.
157 gfx::Point selection_start;
158 gfx::Point selection_end;
159 #endif
162 } // namespace content
164 #endif // CONTENT_PUBLIC_COMMON_CONTEXT_MENU_PARAMS_H_