| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2010 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | 22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
| 23 * THE POSSIBILITY OF SUCH DAMAGE. | 23 * THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #include "config.h" | 26 #include "config.h" |
| 27 #include "core/platform/ContextMenu.h" | 27 #include "core/platform/ContextMenu.h" |
| 28 | 28 |
| 29 namespace WebCore { | 29 namespace WebCore { |
| 30 | 30 |
| 31 ContextMenu::ContextMenu() | |
| 32 { | |
| 33 } | |
| 34 | |
| 35 static const ContextMenuItem* findItemWithAction(unsigned action, const Vector<C
ontextMenuItem>& items) | 31 static const ContextMenuItem* findItemWithAction(unsigned action, const Vector<C
ontextMenuItem>& items) |
| 36 { | 32 { |
| 37 for (size_t i = 0; i < items.size(); ++i) { | 33 for (size_t i = 0; i < items.size(); ++i) { |
| 38 const ContextMenuItem& item = items[i]; | 34 const ContextMenuItem& item = items[i]; |
| 39 if (item.action() == static_cast<ContextMenuAction>(action)) | 35 if (item.action() == static_cast<ContextMenuAction>(action)) |
| 40 return &item; | 36 return &item; |
| 41 if (item.type() != SubmenuType) | 37 if (item.type() != SubmenuType) |
| 42 continue; | 38 continue; |
| 43 if (const ContextMenuItem* subMenuItem = findItemWithAction(action, item
.subMenuItems())) | 39 if (const ContextMenuItem* subMenuItem = findItemWithAction(action, item
.subMenuItems())) |
| 44 return subMenuItem; | 40 return subMenuItem; |
| 45 } | 41 } |
| 46 | 42 |
| 47 return 0; | 43 return 0; |
| 48 } | 44 } |
| 49 | 45 |
| 50 const ContextMenuItem* ContextMenu::itemWithAction(unsigned action) | 46 const ContextMenuItem* ContextMenu::itemWithAction(unsigned action) const |
| 51 { | 47 { |
| 52 return findItemWithAction(action, m_items); | 48 return findItemWithAction(action, m_items); |
| 53 } | 49 } |
| 54 | 50 |
| 55 } // namespace WebCore | 51 } // namespace WebCore |
| OLD | NEW |