| 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 "base/logging.h" |
| 10 | 10 |
| 11 // This class is for scoping only. | 11 // The type of node that the user may perform a contextual action on |
| 12 class ContextNode { | 12 // in the WebView. |
| 13 public: | 13 struct ContextNode { |
| 14 // This enumeration defines the type of node that the user may perform a | 14 enum TypeBit { |
| 15 // contextual action on in the WebView. | |
| 16 enum Type { | |
| 17 | |
| 18 // No node is selected | 15 // No node is selected |
| 19 NONE = 0, | 16 NONE = 0x0, |
| 20 | 17 |
| 21 // The top page is selected | 18 // The top page is selected |
| 22 PAGE = 1, | 19 PAGE = 0x1, |
| 23 | 20 |
| 24 // A subframe page is selected | 21 // A subframe page is selected |
| 25 FRAME = 2, | 22 FRAME = 0x2, |
| 26 | 23 |
| 27 // A link is selected | 24 // A link is selected |
| 28 LINK = 3, | 25 LINK = 0x4, |
| 29 | 26 |
| 30 // An image is selected | 27 // An image is selected |
| 31 IMAGE = 4, | 28 IMAGE = 0x8, |
| 32 | |
| 33 // An image that is also a link is selected | |
| 34 IMAGE_LINK = 5, | |
| 35 | 29 |
| 36 // There is a textual or mixed selection that is selected | 30 // There is a textual or mixed selection that is selected |
| 37 SELECTION = 6, | 31 SELECTION = 0x10, |
| 38 | 32 |
| 39 // An editiable element is selected | 33 // An editable element is selected |
| 40 EDITABLE = 7, | 34 EDITABLE = 0x20, |
| 41 | 35 |
| 42 // A misspelled word is selected | 36 // A misspelled word is selected |
| 43 MISPELLED_WORD = 8 | 37 MISSPELLED_WORD = 0x40, |
| 44 }; | 38 }; |
| 45 | 39 |
| 46 static Type FromInt(int32 type) { | |
| 47 return static_cast<Type>(type); | |
| 48 } | |
| 49 | |
| 50 enum Capability { | 40 enum Capability { |
| 51 CAN_DO_NONE = 0x0, | 41 CAN_DO_NONE = 0x0, |
| 52 CAN_UNDO = 0x1, | 42 CAN_UNDO = 0x1, |
| 53 CAN_REDO = 0x2, | 43 CAN_REDO = 0x2, |
| 54 CAN_CUT = 0x4, | 44 CAN_CUT = 0x4, |
| 55 CAN_COPY = 0x8, | 45 CAN_COPY = 0x8, |
| 56 CAN_PASTE = 0x10, | 46 CAN_PASTE = 0x10, |
| 57 CAN_DELETE = 0x20, | 47 CAN_DELETE = 0x20, |
| 58 CAN_SELECT_ALL = 0x40, | 48 CAN_SELECT_ALL = 0x40, |
| 59 }; | 49 }; |
| 50 |
| 51 int32 type; |
| 52 ContextNode() : type(NONE) {} |
| 53 explicit ContextNode(int32 t) : type(t) {} |
| 60 }; | 54 }; |
| 61 | 55 |
| 62 #endif // WEBKIT_GLUE_CONTEXT_NODE_TYPES_H__ | 56 #endif // WEBKIT_GLUE_CONTEXT_NODE_TYPES_H__ |
| 63 | 57 |
| OLD | NEW |