Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / public / web / WebContextMenuData.h
blobfaa6355190fa4c04f18ee2e297c2b8c165fe6c42
1 /*
2 * Copyright (C) 2009, 2012 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
6 * met:
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.
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 "../platform/WebPoint.h"
35 #include "../platform/WebReferrerPolicy.h"
36 #include "../platform/WebString.h"
37 #include "../platform/WebURL.h"
38 #include "../platform/WebURLResponse.h"
39 #include "../platform/WebVector.h"
40 #include "WebHistoryItem.h"
41 #include "WebMenuItemInfo.h"
42 #include "WebNode.h"
44 #define WEBCONTEXT_MEDIATYPEFILE_DEFINED
46 namespace blink {
48 // This struct is passed to WebViewClient::ShowContextMenu.
49 struct WebContextMenuData {
50 enum MediaType {
51 // No special node is in context.
52 MediaTypeNone,
53 // An image node is selected.
54 MediaTypeImage,
55 // A video node is selected.
56 MediaTypeVideo,
57 // An audio node is selected.
58 MediaTypeAudio,
59 // A canvas node is selected.
60 MediaTypeCanvas,
61 // A file node is selected.
62 MediaTypeFile,
63 // A plugin node is selected.
64 MediaTypePlugin,
65 MediaTypeLast = MediaTypePlugin
67 // The type of media the context menu is being invoked on.
68 MediaType mediaType;
70 // The x and y position of the mouse pointer (relative to the webview).
71 WebPoint mousePosition;
73 // The absolute URL of the link that is in context.
74 WebURL linkURL;
76 // The absolute URL of the image/video/audio that is in context.
77 WebURL srcURL;
79 // Whether the image in context is a null.
80 bool hasImageContents;
82 // If |media_type| is MediaTypeImage and |has_image_contents| is true, then
83 // this contains the image's WebURLResponse.
84 WebURLResponse imageResponse;
86 // The absolute URL of the page in context.
87 WebURL pageURL;
89 // The absolute keyword search URL including the %s search tag when the
90 // "Add as search engine..." option is clicked (left empty if not used).
91 WebURL keywordURL;
93 // The absolute URL of the subframe in context.
94 WebURL frameURL;
96 // The encoding for the frame in context.
97 WebString frameEncoding;
99 // History state of the subframe in context.
100 WebHistoryItem frameHistoryItem;
102 enum MediaFlags {
103 MediaNone = 0x0,
104 MediaInError = 0x1,
105 MediaPaused = 0x2,
106 MediaMuted = 0x4,
107 MediaLoop = 0x8,
108 MediaCanSave = 0x10,
109 MediaHasAudio = 0x20,
110 MediaCanToggleControls = 0x40,
111 MediaControls = 0x80,
112 MediaCanPrint = 0x100,
113 MediaCanRotate = 0x200,
116 // Extra attributes describing media elements.
117 int mediaFlags;
119 // The text of the link that is in the context.
120 WebString linkText;
122 // The raw text of the selection in context.
123 WebString selectedText;
125 // Title attribute or alt attribute (if title is not available) of the selection in context.
126 WebString titleText;
128 // Whether spell checking is enabled.
129 bool isSpellCheckingEnabled;
131 // Suggested filename for saving file.
132 WebString suggestedFilename;
134 // The editable (possibily) misspelled word.
135 WebString misspelledWord;
137 // The identifier of the misspelling.
138 uint32_t misspellingHash;
140 // If misspelledWord is not empty, holds suggestions from the dictionary.
141 WebVector<WebString> dictionarySuggestions;
143 // Whether context is editable.
144 bool isEditable;
146 enum InputFieldType {
147 // Not an input field.
148 InputFieldTypeNone,
149 // type = text, tel, search, number, email, url
150 InputFieldTypePlainText,
151 // type = password
152 InputFieldTypePassword,
153 // type = <etc.>
154 InputFieldTypeOther,
155 InputFieldTypeLast = InputFieldTypeOther
158 // If this node is an input field, the type of that field.
159 InputFieldType inputFieldType;
161 enum CheckableMenuItemFlags {
162 CheckableMenuItemDisabled = 0x0,
163 CheckableMenuItemEnabled = 0x1,
164 CheckableMenuItemChecked = 0x2,
167 // Writing direction menu items - values are unions of
168 // CheckableMenuItemFlags.
169 int writingDirectionDefault;
170 int writingDirectionLeftToRight;
171 int writingDirectionRightToLeft;
173 enum EditFlags {
174 CanDoNone = 0x0,
175 CanUndo = 0x1,
176 CanRedo = 0x2,
177 CanCut = 0x4,
178 CanCopy = 0x8,
179 CanPaste = 0x10,
180 CanDelete = 0x20,
181 CanSelectAll = 0x40,
182 CanTranslate = 0x80,
185 // Which edit operations are available in the context.
186 int editFlags;
188 // Security information for the context.
189 WebCString securityInfo;
191 // The referrer policy applicable to this context.
192 WebReferrerPolicy referrerPolicy;
194 // Custom context menu items provided by the WebCore internals.
195 WebVector<WebMenuItemInfo> customItems;
197 // The node that was clicked.
198 WebNode node;
200 WebContextMenuData()
201 : mediaType(MediaTypeNone)
202 , hasImageContents(true)
203 , mediaFlags(MediaNone)
204 , isSpellCheckingEnabled(false)
205 , misspellingHash(0)
206 , isEditable(false)
207 , writingDirectionDefault(CheckableMenuItemDisabled)
208 , writingDirectionLeftToRight(CheckableMenuItemEnabled)
209 , writingDirectionRightToLeft(CheckableMenuItemEnabled)
210 , editFlags(0) { }
213 } // namespace blink
215 #endif