| OLD | NEW |
| 1 // Copyright (c) 2006-2009 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" |
| 12 | 12 |
| 13 // The type of node that the user may perform a contextual action on | 13 // The type of node that the user may perform a contextual action on |
| 14 // in the WebView. | 14 // in the WebView. |
| 15 struct ContextNode { | 15 struct ContextNodeType { |
| 16 enum TypeBit { | 16 enum TypeBit { |
| 17 // No node is selected | 17 // No node is selected |
| 18 NONE = 0x0, | 18 NONE = 0x0, |
| 19 | 19 |
| 20 // The top page is selected | 20 // The top page is selected |
| 21 PAGE = 0x1, | 21 PAGE = 0x1, |
| 22 | 22 |
| 23 // A subframe page is selected | 23 // A subframe page is selected |
| 24 FRAME = 0x2, | 24 FRAME = 0x2, |
| 25 | 25 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 50 CAN_UNDO = 0x1, | 50 CAN_UNDO = 0x1, |
| 51 CAN_REDO = 0x2, | 51 CAN_REDO = 0x2, |
| 52 CAN_CUT = 0x4, | 52 CAN_CUT = 0x4, |
| 53 CAN_COPY = 0x8, | 53 CAN_COPY = 0x8, |
| 54 CAN_PASTE = 0x10, | 54 CAN_PASTE = 0x10, |
| 55 CAN_DELETE = 0x20, | 55 CAN_DELETE = 0x20, |
| 56 CAN_SELECT_ALL = 0x40, | 56 CAN_SELECT_ALL = 0x40, |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 int32 type; | 59 int32 type; |
| 60 ContextNode() : type(NONE) {} | 60 ContextNodeType() : type(NONE) {} |
| 61 explicit ContextNode(int32 t) : type(t) {} | 61 explicit ContextNodeType(int32 t) : type(t) {} |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 // Parameters structure used in ContextMenuParams with attributes needed to | 64 // Parameters structure used in ContextMenuParams with attributes needed to |
| 65 // render the context menu for media elements. | 65 // render the context menu for media elements. |
| 66 // | 66 // |
| 67 // TODO(ajwong): Add support for multiple audio tracks and subtitles. | 67 // TODO(ajwong): Add support for multiple audio tracks and subtitles. |
| 68 struct ContextMenuMediaParams { | 68 struct ContextMenuMediaParams { |
| 69 // Values for the bitfield representing the state of the media player. | 69 // Values for the bitfield representing the state of the media player. |
| 70 // If the state is in ERROR, most media controls should disable | 70 // If the state is IN_ERROR, most media controls should disable |
| 71 // themselves. | 71 // themselves. |
| 72 enum PlayerState { | 72 enum PlayerStateBit { |
| 73 PLAYER_NO_STATE = 0x0, | 73 NO_STATE = 0x0, |
| 74 PLAYER_ERROR = 0x1, | 74 IN_ERROR = 0x1, |
| 75 PLAYER_PAUSED = 0x2, | 75 PAUSED = 0x2, |
| 76 PLAYER_MUTED = 0x4, | 76 MUTED = 0x4, |
| 77 PLAYER_LOOP = 0x8, | 77 LOOP = 0x8, |
| 78 PLAYER_CAN_SAVE = 0x10, | 78 CAN_SAVE = 0x10, |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 // A bitfield representing the current state of the player, such as | 81 // A bitfield representing the current state of the player, such as |
| 82 // playing, muted, etc. | 82 // playing, muted, etc. |
| 83 int32 player_state; | 83 int32 player_state; |
| 84 | 84 |
| 85 // The current playback rate for this media element. | 85 // The current playback rate for this media element. |
| 86 double playback_rate; | 86 double playback_rate; |
| 87 | 87 |
| 88 ContextMenuMediaParams() | 88 ContextMenuMediaParams() |
| 89 : player_state(PLAYER_NO_STATE), playback_rate(1.0f) { | 89 : player_state(NO_STATE), playback_rate(1.0f) { |
| 90 } | 90 } |
| 91 }; | 91 }; |
| 92 | 92 |
| 93 // Parameters structure for ViewHostMsg_ContextMenu. | 93 // Parameters structure for ViewHostMsg_ContextMenu. |
| 94 // 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 |
| 95 // if the parameters here weren't so literally mapped to what | 95 // if the parameters here weren't so literally mapped to what |
| 96 // they contain for the ContextMenu task. It might be better | 96 // they contain for the ContextMenu task. It might be better |
| 97 // to make the string fields more generic so that this object | 97 // to make the string fields more generic so that this object |
| 98 // could be used for more contextual actions. | 98 // could be used for more contextual actions. |
| 99 struct ContextMenuParams { | 99 struct ContextMenuParams { |
| 100 // 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. |
| 101 ContextNode node; | 101 ContextNodeType node_type; |
| 102 | 102 |
| 103 // 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 |
| 104 // was invoked. Coords are relative to the associated RenderView's origin. | 104 // was invoked. Coords are relative to the associated RenderView's origin. |
| 105 int x; | 105 int x; |
| 106 int y; | 106 int y; |
| 107 | 107 |
| 108 // 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 |
| 109 // invoked on. | 109 // invoked on. |
| 110 GURL link_url; | 110 GURL link_url; |
| 111 | 111 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 // able to perform the corresponding action. | 150 // able to perform the corresponding action. |
| 151 int edit_flags; | 151 int edit_flags; |
| 152 | 152 |
| 153 // 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. |
| 154 std::string security_info; | 154 std::string security_info; |
| 155 | 155 |
| 156 // 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. |
| 157 std::string frame_charset; | 157 std::string frame_charset; |
| 158 }; | 158 }; |
| 159 | 159 |
| 160 struct MediaPlayerAction { |
| 161 enum CommandTypeBit { |
| 162 NONE = 0x0, |
| 163 PLAY = 0x1, |
| 164 PAUSE = 0x2, |
| 165 MUTE = 0x4, |
| 166 UNMUTE = 0x8, |
| 167 LOOP = 0x10, |
| 168 NO_LOOP = 0x20, |
| 169 SET_PLAYBACK_RATE = 0x40, |
| 170 }; |
| 171 |
| 172 // A bitfield representing the actions that the context menu should execute |
| 173 // on the originating node. |
| 174 int32 command; |
| 175 |
| 176 // The new playback rate to set if the action is SET_PLAYBACK_RATE. |
| 177 double playback_rate; |
| 178 |
| 179 MediaPlayerAction() : command(NONE), playback_rate(1.0f) {} |
| 180 explicit MediaPlayerAction(int c) : command(c), playback_rate(1.0f) {} |
| 181 MediaPlayerAction(int c, double rate) : command(c), playback_rate(rate) {} |
| 182 }; |
| 183 |
| 160 #endif // WEBKIT_GLUE_CONTEXT_NODE_TYPES_H__ | 184 #endif // WEBKIT_GLUE_CONTEXT_NODE_TYPES_H__ |
| OLD | NEW |