OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/logging.h" | 9 #include "googleurl\src\gurl.h" |
10 | 10 |
11 // The type of node that the user may perform a contextual action on | 11 // The type of node that the user may perform a contextual action on |
12 // in the WebView. | 12 // in the WebView. |
13 struct ContextNode { | 13 struct ContextNode { |
14 enum TypeBit { | 14 enum TypeBit { |
15 // No node is selected | 15 // No node is selected |
16 NONE = 0x0, | 16 NONE = 0x0, |
17 | 17 |
18 // The top page is selected | 18 // The top page is selected |
19 PAGE = 0x1, | 19 PAGE = 0x1, |
(...skipping 26 matching lines...) Expand all Loading... |
46 CAN_PASTE = 0x10, | 46 CAN_PASTE = 0x10, |
47 CAN_DELETE = 0x20, | 47 CAN_DELETE = 0x20, |
48 CAN_SELECT_ALL = 0x40, | 48 CAN_SELECT_ALL = 0x40, |
49 }; | 49 }; |
50 | 50 |
51 int32 type; | 51 int32 type; |
52 ContextNode() : type(NONE) {} | 52 ContextNode() : type(NONE) {} |
53 explicit ContextNode(int32 t) : type(t) {} | 53 explicit ContextNode(int32 t) : type(t) {} |
54 }; | 54 }; |
55 | 55 |
| 56 // Parameters structure for ViewHostMsg_ContextMenu. |
| 57 // FIXME(beng): This would be more useful in the future and more efficient |
| 58 // if the parameters here weren't so literally mapped to what |
| 59 // they contain for the ContextMenu task. It might be better |
| 60 // to make the string fields more generic so that this object |
| 61 // could be used for more contextual actions. |
| 62 struct ContextMenuParams { |
| 63 // This is the type of Context Node that the context menu was invoked on. |
| 64 ContextNode node; |
| 65 |
| 66 // These values represent the coordinates of the mouse when the context menu |
| 67 // was invoked. Coords are relative to the associated RenderView's origin. |
| 68 int x; |
| 69 int y; |
| 70 |
| 71 // This is the URL of the link that encloses the node the context menu was |
| 72 // invoked on. |
| 73 GURL link_url; |
| 74 |
| 75 // This is the URL of the image the context menu was invoked on. |
| 76 GURL image_url; |
| 77 |
| 78 // This is the URL of the top level page that the context menu was invoked |
| 79 // on. |
| 80 GURL page_url; |
| 81 |
| 82 // This is the URL of the subframe that the context menu was invoked on. |
| 83 GURL frame_url; |
| 84 |
| 85 // This is the text of the selection that the context menu was invoked on. |
| 86 std::wstring selection_text; |
| 87 |
| 88 // The misspelled word under the cursor, if any. Used to generate the |
| 89 // |dictionary_suggestions| list. |
| 90 std::wstring misspelled_word; |
| 91 |
| 92 // Suggested replacements for a misspelled word under the cursor. |
| 93 // This vector gets populated in the render process host |
| 94 // by intercepting ViewHostMsg_ContextMenu in ResourceMessageFilter |
| 95 // and populating dictionary_suggestions if the type is EDITABLE |
| 96 // and the misspelled_word is not empty. |
| 97 std::vector<std::wstring> dictionary_suggestions; |
| 98 |
| 99 // If editable, flag for whether spell check is enabled or not. |
| 100 bool spellcheck_enabled; |
| 101 |
| 102 // These flags indicate to the browser whether the renderer believes it is |
| 103 // able to perform the corresponding action. |
| 104 int edit_flags; |
| 105 |
| 106 // The security info for the resource we are showing the menu on. |
| 107 std::string security_info; |
| 108 }; |
| 109 |
56 #endif // WEBKIT_GLUE_CONTEXT_NODE_TYPES_H__ | 110 #endif // WEBKIT_GLUE_CONTEXT_NODE_TYPES_H__ |
57 | 111 |
OLD | NEW |