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