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_
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"
21 struct CONTENT_EXPORT CustomContextMenuContext
{
22 static const int32 kCurrentRenderWidget
;
24 CustomContextMenuContext();
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
{
41 explicit ContextMenuParams(const WebKit::WebContextMenuData
& data
);
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.
52 // This is the URL of the link that encloses the node the context menu was
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
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
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).
76 // This is the URL of the subframe that the context menu was invoked on.
79 // This is the ID of the subframe that the context menu was invoked on.
82 // This is the history item state of the subframe that the context menu was
84 std::string frame_content_state
;
86 // These are the parameters for the media element that the context menu
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.
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
;
121 // These flags indicate to the browser whether the renderer believes it is
122 // able to perform the corresponding action.
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_