Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(183)

Side by Side Diff: Source/WebCore/platform/chromium/ContextMenuChromium.cpp

Issue 14185003: Use ContextMenu code path that was guarded by CROSS_PLATFORM_CONTEXT_MENU (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Use ContextMenu code path that was guarded by CROSS_PLATFORM_CONTEXT_MENU Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2008, 2009, Google Inc. All rights reserved. 2 * Copyright (c) 2008, 2009, Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 13 matching lines...) Expand all
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "ContextMenu.h" 32 #include "ContextMenu.h"
33 33
34 #include "NotImplemented.h"
35
34 namespace WebCore { 36 namespace WebCore {
35 37
36 // This is a stub implementation of WebKit's ContextMenu class that does 38 ContextMenu::ContextMenu(PlatformContextMenu menu)
37 // nothing.
38
39 ContextMenu::ContextMenu()
40 { 39 {
40 getContextMenuItems(menu, m_items);
41 } 41 }
42 42
43 ContextMenu::ContextMenu(const PlatformMenuDescription menu) 43 void ContextMenu::getContextMenuItems(PlatformContextMenu, Vector<ContextMenuIte m>&)
44 { 44 {
45 notImplemented();
45 } 46 }
46 47
47 ContextMenu::~ContextMenu() 48 PlatformContextMenu ContextMenu::createPlatformContextMenuFromItems(const Vector <ContextMenuItem>&)
48 { 49 {
49 } 50 notImplemented();
50
51 unsigned ContextMenu::itemCount() const
52 {
53 return m_items.size();
54 }
55
56 void ContextMenu::insertItem(unsigned position, ContextMenuItem& item)
57 {
58 m_items.insert(position, item);
59 }
60
61 void ContextMenu::appendItem(ContextMenuItem& item)
62 {
63 m_items.append(item);
64 }
65
66 ContextMenuItem* ContextMenu::itemWithAction(unsigned action)
67 {
68 Vector<Vector<ContextMenuItem>*> menuItemStack;
69 menuItemStack.append(&m_items);
70 while (!menuItemStack.isEmpty()) {
71 Vector<ContextMenuItem>& items = *(menuItemStack.last());
72 menuItemStack.removeLast();
73 for (size_t i = 0; i < items.size(); ++i) {
74 if (items[i].action() == static_cast<ContextMenuAction>(action))
75 return &items[i];
76 if (items[i].type() == SubmenuType)
77 menuItemStack.append(const_cast<Vector<ContextMenuItem>*>(items[ i].platformSubMenu()));
78 }
79 }
80 return 0; 51 return 0;
81 } 52 }
82 53
83 ContextMenuItem* ContextMenu::itemAtIndex(unsigned index, const PlatformMenuDesc ription platformDescription) 54 PlatformContextMenu ContextMenu::platformContextMenu() const
84 { 55 {
85 return &m_items[index]; 56 return createPlatformContextMenuFromItems(m_items);
86 } 57 }
87 58
88 void ContextMenu::setPlatformDescription(PlatformMenuDescription menu)
89 {
90 } 59 }
91
92 PlatformMenuDescription ContextMenu::platformDescription() const
93 {
94 return &m_items;
95 }
96
97 PlatformMenuDescription ContextMenu::releasePlatformDescription()
98 {
99 return 0;
100 }
101
102 Vector<ContextMenuItem> contextMenuItemVector(const PlatformMenuDescription menu Description)
103 {
104 return *menuDescription;
105 }
106
107 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/WebCore/platform/PlatformMenuDescription.h ('k') | Source/WebCore/platform/chromium/ContextMenuItemChromium.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698