OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. | |
3 * | |
4 * Redistribution and use in source and binary forms, with or without | |
5 * modification, are permitted provided that the following conditions are | |
6 * met: | |
7 * | |
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 | |
13 * distribution. | |
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. | |
17 * | |
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. | |
29 */ | |
30 | |
31 #ifndef WebContextMenuData_h | |
32 #define WebContextMenuData_h | |
33 | |
34 #include "../platform/WebPoint.h" | |
35 #include "../platform/WebReferrerPolicy.h" | |
36 #include "../platform/WebString.h" | |
37 #include "../platform/WebURL.h" | |
38 #include "../platform/WebVector.h" | |
39 #include "WebHistoryItem.h" | |
40 #include "WebMenuItemInfo.h" | |
41 #include "WebNode.h" | |
42 | |
43 #define WEBCONTEXT_MEDIATYPEFILE_DEFINED | |
44 | |
45 namespace WebKit { | |
46 | |
47 // This struct is passed to WebViewClient::ShowContextMenu. | |
48 struct WebContextMenuData { | |
49 enum MediaType { | |
50 // No special node is in context. | |
51 MediaTypeNone, | |
52 // An image node is selected. | |
53 MediaTypeImage, | |
54 // A video node is selected. | |
55 MediaTypeVideo, | |
56 // An audio node is selected. | |
57 MediaTypeAudio, | |
58 // A file node is selected. | |
59 MediaTypeFile, | |
60 // A plugin node is selected. | |
61 MediaTypePlugin, | |
62 }; | |
63 // The type of media the context menu is being invoked on. | |
64 MediaType mediaType; | |
65 | |
66 // The x and y position of the mouse pointer (relative to the webview). | |
67 WebPoint mousePosition; | |
68 | |
69 // The absolute URL of the link that is in context. | |
70 WebURL linkURL; | |
71 | |
72 // The absolute URL of the image/video/audio that is in context. | |
73 WebURL srcURL; | |
74 | |
75 // Whether the image in context has been blocked. | |
76 bool isImageBlocked; | |
77 | |
78 // The absolute URL of the page in context. | |
79 WebURL pageURL; | |
80 | |
81 // The absolute keyword search URL including the %s search tag when the | |
82 // "Add as search engine..." option is clicked (left empty if not used). | |
83 WebURL keywordURL; | |
84 | |
85 // The absolute URL of the subframe in context. | |
86 WebURL frameURL; | |
87 | |
88 // The encoding for the frame in context. | |
89 WebString frameEncoding; | |
90 | |
91 // History state of the subframe in context. | |
92 WebHistoryItem frameHistoryItem; | |
93 | |
94 enum MediaFlags { | |
95 MediaNone = 0x0, | |
96 MediaInError = 0x1, | |
97 MediaPaused = 0x2, | |
98 MediaMuted = 0x4, | |
99 MediaLoop = 0x8, | |
100 MediaCanSave = 0x10, | |
101 MediaHasAudio = 0x20, | |
102 MediaHasVideo = 0x40, | |
103 MediaControls = 0x80, | |
104 MediaCanPrint = 0x100, | |
105 MediaCanRotate = 0x200, | |
106 }; | |
107 | |
108 // Extra attributes describing media elements. | |
109 int mediaFlags; | |
110 | |
111 // The raw text of the selection in context. | |
112 WebString selectedText; | |
113 | |
114 // Whether speech input is enabled. | |
115 bool isSpeechInputEnabled; | |
116 | |
117 // Whether spell checking is enabled. | |
118 bool isSpellCheckingEnabled; | |
119 | |
120 // The editable (possibily) misspelled word. | |
121 WebString misspelledWord; | |
122 | |
123 // The identifier of the misspelling. | |
124 uint32_t misspellingHash; | |
125 | |
126 // If misspelledWord is not empty, holds suggestions from the dictionary. | |
127 WebVector<WebString> dictionarySuggestions; | |
128 | |
129 // Whether context is editable. | |
130 bool isEditable; | |
131 | |
132 enum CheckableMenuItemFlags { | |
133 CheckableMenuItemDisabled = 0x0, | |
134 CheckableMenuItemEnabled = 0x1, | |
135 CheckableMenuItemChecked = 0x2, | |
136 }; | |
137 | |
138 // Writing direction menu items - values are unions of | |
139 // CheckableMenuItemFlags. | |
140 // Currently only used on OS X. | |
141 int writingDirectionDefault; | |
142 int writingDirectionLeftToRight; | |
143 int writingDirectionRightToLeft; | |
144 | |
145 enum EditFlags { | |
146 CanDoNone = 0x0, | |
147 CanUndo = 0x1, | |
148 CanRedo = 0x2, | |
149 CanCut = 0x4, | |
150 CanCopy = 0x8, | |
151 CanPaste = 0x10, | |
152 CanDelete = 0x20, | |
153 CanSelectAll = 0x40, | |
154 CanTranslate = 0x80, | |
155 }; | |
156 | |
157 // Which edit operations are available in the context. | |
158 int editFlags; | |
159 | |
160 // Security information for the context. | |
161 WebCString securityInfo; | |
162 | |
163 // The referrer policy applicable to this context. | |
164 WebReferrerPolicy referrerPolicy; | |
165 | |
166 // Custom context menu items provided by the WebCore internals. | |
167 WebVector<WebMenuItemInfo> customItems; | |
168 | |
169 // The node that was clicked. | |
170 WebNode node; | |
171 | |
172 WebContextMenuData() | |
173 : mediaType(MediaTypeNone) | |
174 , isImageBlocked(false) | |
175 , mediaFlags(MediaNone) | |
176 , isSpeechInputEnabled(false) | |
177 , isSpellCheckingEnabled(false) | |
178 , isEditable(false) | |
179 , writingDirectionDefault(CheckableMenuItemDisabled) | |
180 , writingDirectionLeftToRight(CheckableMenuItemEnabled) | |
181 , writingDirectionRightToLeft(CheckableMenuItemEnabled) | |
182 , editFlags(0) { } | |
183 }; | |
184 | |
185 } // namespace WebKit | |
186 | |
187 #endif | |
OLD | NEW |