2 * Copyright (C) 2009 Google Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the
14 * * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 #ifndef WebContextMenuData_h
32 #define WebContextMenuData_h
34 #include "WebHistoryItem.h"
35 #include "WebMenuItemInfo.h"
37 #include "platform/WebPoint.h"
38 #include "platform/WebString.h"
39 #include "platform/WebURL.h"
40 #include "platform/WebVector.h"
42 #define WEBCONTEXT_MEDIATYPEFILE_DEFINED
46 // This struct is passed to WebViewClient::ShowContextMenu.
47 struct WebContextMenuData {
49 // No special node is in context.
51 // An image node is selected.
53 // A video node is selected.
55 // An audio node is selected.
57 // A file node is selected.
59 // A plugin node is selected.
62 // The type of media the context menu is being invoked on.
65 // The x and y position of the mouse pointer (relative to the webview).
66 WebPoint mousePosition;
68 // The absolute URL of the link that is in context.
71 // The absolute URL of the image/video/audio that is in context.
74 // Whether the image in context has been blocked.
77 // The absolute URL of the page in context.
80 // The absolute keyword search URL including the %s search tag when the
81 // "Add as search engine..." option is clicked (left empty if not used).
84 // The absolute URL of the subframe in context.
87 // The encoding for the frame in context.
88 WebString frameEncoding;
90 // History state of the subframe in context.
91 WebHistoryItem frameHistoryItem;
100 MediaHasAudio = 0x20,
101 MediaHasVideo = 0x40,
102 MediaControlRootElement = 0x80,
103 MediaCanPrint = 0x100,
106 // Extra attributes describing media elements.
109 // The raw text of the selection in context.
110 WebString selectedText;
112 // Whether speech input is enabled.
113 bool isSpeechInputEnabled;
115 // Whether spell checking is enabled.
116 bool isSpellCheckingEnabled;
118 // The editable (possibily) misspelled word.
119 WebString misspelledWord;
121 // If misspelledWord is not empty, holds suggestions from the dictionary.
122 WebVector<WebString> dictionarySuggestions;
124 // Whether context is editable.
127 enum CheckableMenuItemFlags {
128 CheckableMenuItemDisabled = 0x0,
129 CheckableMenuItemEnabled = 0x1,
130 CheckableMenuItemChecked = 0x2,
133 // Writing direction menu items - values are unions of
134 // CheckableMenuItemFlags.
135 // Currently only used on OS X.
136 int writingDirectionDefault;
137 int writingDirectionLeftToRight;
138 int writingDirectionRightToLeft;
152 // Which edit operations are available in the context.
155 // Security information for the context.
156 WebCString securityInfo;
158 // Custom context menu items provided by the WebCore internals.
159 WebVector<WebMenuItemInfo> customItems;
161 // The node that was clicked.
165 : mediaType(MediaTypeNone)
166 , isImageBlocked(false)
167 , mediaFlags(MediaNone)
168 , isSpeechInputEnabled(false)
169 , isSpellCheckingEnabled(false)
171 , writingDirectionDefault(CheckableMenuItemDisabled)
172 , writingDirectionLeftToRight(CheckableMenuItemEnabled)
173 , writingDirectionRightToLeft(CheckableMenuItemEnabled)
177 } // namespace WebKit