| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef WEBKIT_GLUE_CONTEXT_NODE_TYPES_H__ | 5 #ifndef WEBKIT_GLUE_CONTEXT_NODE_TYPES_H__ |
| 6 #define WEBKIT_GLUE_CONTEXT_NODE_TYPES_H__ | 6 #define WEBKIT_GLUE_CONTEXT_NODE_TYPES_H__ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "googleurl/src/gurl.h" | 11 #include "googleurl/src/gurl.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 30 IMAGE = 0x8, | 30 IMAGE = 0x8, |
| 31 | 31 |
| 32 // There is a textual or mixed selection that is selected | 32 // There is a textual or mixed selection that is selected |
| 33 SELECTION = 0x10, | 33 SELECTION = 0x10, |
| 34 | 34 |
| 35 // An editable element is selected | 35 // An editable element is selected |
| 36 EDITABLE = 0x20, | 36 EDITABLE = 0x20, |
| 37 | 37 |
| 38 // A misspelled word is selected | 38 // A misspelled word is selected |
| 39 MISSPELLED_WORD = 0x40, | 39 MISSPELLED_WORD = 0x40, |
| 40 |
| 41 // A video node is selected |
| 42 VIDEO = 0x80, |
| 43 |
| 44 // A video node is selected |
| 45 AUDIO = 0x100, |
| 40 }; | 46 }; |
| 41 | 47 |
| 42 enum Capability { | 48 enum Capability { |
| 43 CAN_DO_NONE = 0x0, | 49 CAN_DO_NONE = 0x0, |
| 44 CAN_UNDO = 0x1, | 50 CAN_UNDO = 0x1, |
| 45 CAN_REDO = 0x2, | 51 CAN_REDO = 0x2, |
| 46 CAN_CUT = 0x4, | 52 CAN_CUT = 0x4, |
| 47 CAN_COPY = 0x8, | 53 CAN_COPY = 0x8, |
| 48 CAN_PASTE = 0x10, | 54 CAN_PASTE = 0x10, |
| 49 CAN_DELETE = 0x20, | 55 CAN_DELETE = 0x20, |
| 50 CAN_SELECT_ALL = 0x40, | 56 CAN_SELECT_ALL = 0x40, |
| 51 }; | 57 }; |
| 52 | 58 |
| 53 int32 type; | 59 int32 type; |
| 54 ContextNode() : type(NONE) {} | 60 ContextNode() : type(NONE) {} |
| 55 explicit ContextNode(int32 t) : type(t) {} | 61 explicit ContextNode(int32 t) : type(t) {} |
| 56 }; | 62 }; |
| 57 | 63 |
| 64 // Parameters structure used in ContextMenuParams with attributes needed to |
| 65 // render the context menu for media elements. |
| 66 // |
| 67 // TODO(ajwong): Add support for multiple audio tracks and subtitles. |
| 68 struct ContextMenuMediaParams { |
| 69 // Values for the bitfield representing the state of the media player. |
| 70 // If the state is in ERROR, most media controls should disable |
| 71 // themselves. |
| 72 enum PlayerState { |
| 73 PLAYER_NO_STATE = 0x0, |
| 74 PLAYER_ERROR = 0x1, |
| 75 PLAYER_PAUSED = 0x2, |
| 76 PLAYER_MUTED = 0x4, |
| 77 PLAYER_LOOP = 0x8, |
| 78 PLAYER_CAN_SAVE = 0x10, |
| 79 }; |
| 80 |
| 81 // A bitfield representing the current state of the player, such as |
| 82 // playing, muted, etc. |
| 83 int32 player_state; |
| 84 |
| 85 // The current playback rate for this media element. |
| 86 double playback_rate; |
| 87 |
| 88 ContextMenuMediaParams() |
| 89 : player_state(PLAYER_NO_STATE), playback_rate(1.0f) { |
| 90 } |
| 91 }; |
| 92 |
| 58 // Parameters structure for ViewHostMsg_ContextMenu. | 93 // Parameters structure for ViewHostMsg_ContextMenu. |
| 59 // FIXME(beng): This would be more useful in the future and more efficient | 94 // FIXME(beng): This would be more useful in the future and more efficient |
| 60 // if the parameters here weren't so literally mapped to what | 95 // if the parameters here weren't so literally mapped to what |
| 61 // they contain for the ContextMenu task. It might be better | 96 // they contain for the ContextMenu task. It might be better |
| 62 // to make the string fields more generic so that this object | 97 // to make the string fields more generic so that this object |
| 63 // could be used for more contextual actions. | 98 // could be used for more contextual actions. |
| 64 struct ContextMenuParams { | 99 struct ContextMenuParams { |
| 65 // This is the type of Context Node that the context menu was invoked on. | 100 // This is the type of Context Node that the context menu was invoked on. |
| 66 ContextNode node; | 101 ContextNode node; |
| 67 | 102 |
| 68 // These values represent the coordinates of the mouse when the context menu | 103 // These values represent the coordinates of the mouse when the context menu |
| 69 // was invoked. Coords are relative to the associated RenderView's origin. | 104 // was invoked. Coords are relative to the associated RenderView's origin. |
| 70 int x; | 105 int x; |
| 71 int y; | 106 int y; |
| 72 | 107 |
| 73 // This is the URL of the link that encloses the node the context menu was | 108 // This is the URL of the link that encloses the node the context menu was |
| 74 // invoked on. | 109 // invoked on. |
| 75 GURL link_url; | 110 GURL link_url; |
| 76 | 111 |
| 77 // The link URL to be used ONLY for "copy link address". We don't validate | 112 // The link URL to be used ONLY for "copy link address". We don't validate |
| 78 // this field in the frontend process. | 113 // this field in the frontend process. |
| 79 GURL unfiltered_link_url; | 114 GURL unfiltered_link_url; |
| 80 | 115 |
| 81 // This is the URL of the image the context menu was invoked on. | 116 // This is the source URL for the element that the context menu was |
| 82 GURL image_url; | 117 // invoked on. Example of elements with source URLs are img, audio, and |
| 118 // video. |
| 119 GURL src_url; |
| 83 | 120 |
| 84 // This is the URL of the top level page that the context menu was invoked | 121 // This is the URL of the top level page that the context menu was invoked |
| 85 // on. | 122 // on. |
| 86 GURL page_url; | 123 GURL page_url; |
| 87 | 124 |
| 88 // This is the URL of the subframe that the context menu was invoked on. | 125 // This is the URL of the subframe that the context menu was invoked on. |
| 89 GURL frame_url; | 126 GURL frame_url; |
| 90 | 127 |
| 128 // These are the parameters for the media element that the context menu |
| 129 // was invoked on. |
| 130 ContextMenuMediaParams media_params; |
| 131 |
| 91 // This is the text of the selection that the context menu was invoked on. | 132 // This is the text of the selection that the context menu was invoked on. |
| 92 std::wstring selection_text; | 133 std::wstring selection_text; |
| 93 | 134 |
| 94 // The misspelled word under the cursor, if any. Used to generate the | 135 // The misspelled word under the cursor, if any. Used to generate the |
| 95 // |dictionary_suggestions| list. | 136 // |dictionary_suggestions| list. |
| 96 std::wstring misspelled_word; | 137 std::wstring misspelled_word; |
| 97 | 138 |
| 98 // Suggested replacements for a misspelled word under the cursor. | 139 // Suggested replacements for a misspelled word under the cursor. |
| 99 // This vector gets populated in the render process host | 140 // This vector gets populated in the render process host |
| 100 // by intercepting ViewHostMsg_ContextMenu in ResourceMessageFilter | 141 // by intercepting ViewHostMsg_ContextMenu in ResourceMessageFilter |
| 101 // and populating dictionary_suggestions if the type is EDITABLE | 142 // and populating dictionary_suggestions if the type is EDITABLE |
| 102 // and the misspelled_word is not empty. | 143 // and the misspelled_word is not empty. |
| 103 std::vector<std::wstring> dictionary_suggestions; | 144 std::vector<std::wstring> dictionary_suggestions; |
| 104 | 145 |
| 105 // If editable, flag for whether spell check is enabled or not. | 146 // If editable, flag for whether spell check is enabled or not. |
| 106 bool spellcheck_enabled; | 147 bool spellcheck_enabled; |
| 107 | 148 |
| 108 // These flags indicate to the browser whether the renderer believes it is | 149 // These flags indicate to the browser whether the renderer believes it is |
| 109 // able to perform the corresponding action. | 150 // able to perform the corresponding action. |
| 110 int edit_flags; | 151 int edit_flags; |
| 111 | 152 |
| 112 // The security info for the resource we are showing the menu on. | 153 // The security info for the resource we are showing the menu on. |
| 113 std::string security_info; | 154 std::string security_info; |
| 114 | 155 |
| 115 // The character encoding of the frame on which the menu is invoked. | 156 // The character encoding of the frame on which the menu is invoked. |
| 116 std::string frame_charset; | 157 std::string frame_charset; |
| 117 }; | 158 }; |
| 118 | 159 |
| 119 #endif // WEBKIT_GLUE_CONTEXT_NODE_TYPES_H__ | 160 #endif // WEBKIT_GLUE_CONTEXT_NODE_TYPES_H__ |
| OLD | NEW |