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

Side by Side Diff: Source/WebCore/platform/ContextMenu.h

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
« no previous file with comments | « Source/WebCore/page/ContextMenuProvider.h ('k') | Source/WebCore/platform/ContextMenu.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2006 Apple Computer, 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
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * 12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #ifndef ContextMenu_h 26 #ifndef ContextMenu_h
27 #define ContextMenu_h 27 #define ContextMenu_h
28 28
29 #if ENABLE(CONTEXT_MENUS) 29 #if ENABLE(CONTEXT_MENUS)
30 30
31 #include <wtf/Noncopyable.h> 31 #include <wtf/Noncopyable.h>
32 32
33 #include "ContextMenuItem.h" 33 #include "ContextMenuItem.h"
34 #include "PlatformMenuDescription.h"
35 #include <wtf/text/WTFString.h> 34 #include <wtf/text/WTFString.h>
36 35
37 namespace WebCore { 36 namespace WebCore {
38 37
39 class ContextMenuController; 38 class ContextMenuController;
40 39
40 typedef void* PlatformContextMenu;
41
41 class ContextMenu { 42 class ContextMenu {
42 WTF_MAKE_NONCOPYABLE(ContextMenu); WTF_MAKE_FAST_ALLOCATED; 43 WTF_MAKE_NONCOPYABLE(ContextMenu); WTF_MAKE_FAST_ALLOCATED;
43 public: 44 public:
44 ContextMenu(); 45 ContextMenu();
45 46
46 ContextMenuItem* itemWithAction(unsigned); 47 const ContextMenuItem* itemWithAction(unsigned);
47 48
48 #if USE(CROSS_PLATFORM_CONTEXT_MENUS)
49 explicit ContextMenu(PlatformContextMenu); 49 explicit ContextMenu(PlatformContextMenu);
50 50
51 PlatformContextMenu platformContextMenu() const; 51 PlatformContextMenu platformContextMenu() const;
52 52
53 static PlatformContextMenu createPlatformContextMenuFromItems(const Vect or<ContextMenuItem>&); 53 static PlatformContextMenu createPlatformContextMenuFromItems(const Vect or<ContextMenuItem>&);
54 static void getContextMenuItems(PlatformContextMenu, Vector<ContextMenuI tem>&); 54 static void getContextMenuItems(PlatformContextMenu, Vector<ContextMenuI tem>&);
55 55
56 // FIXME: When more platforms switch over, this should return const Cont extMenuItem*'s. 56 const ContextMenuItem* itemAtIndex(unsigned index) { return &m_items[ind ex]; }
57 ContextMenuItem* itemAtIndex(unsigned index) { return &m_items[index]; }
58 57
59 void setItems(const Vector<ContextMenuItem>& items) { m_items = items; } 58 void setItems(const Vector<ContextMenuItem>& items) { m_items = items; }
60 const Vector<ContextMenuItem>& items() const { return m_items; } 59 const Vector<ContextMenuItem>& items() const { return m_items; }
61 60
62 void appendItem(const ContextMenuItem& item) { m_items.append(item); } 61 void appendItem(const ContextMenuItem& item) { m_items.append(item); }
63 #else
64 explicit ContextMenu(const PlatformMenuDescription);
65 ~ContextMenu();
66
67 void insertItem(unsigned position, ContextMenuItem&);
68 void appendItem(ContextMenuItem&);
69
70 ContextMenuItem* itemAtIndex(unsigned, const PlatformMenuDescription);
71
72 unsigned itemCount() const;
73
74 PlatformMenuDescription platformDescription() const;
75 void setPlatformDescription(PlatformMenuDescription);
76
77 PlatformMenuDescription releasePlatformDescription();
78
79 #endif // USE(CROSS_PLATFORM_CONTEXT_MENUS)
80 62
81 private: 63 private:
82 Vector<ContextMenuItem> m_items; 64 Vector<ContextMenuItem> m_items;
83 }; 65 };
84
85 #if !USE(CROSS_PLATFORM_CONTEXT_MENUS)
86 Vector<ContextMenuItem> contextMenuItemVector(PlatformMenuDescription);
87 PlatformMenuDescription platformMenuDescription(Vector<ContextMenuItem>&);
88 #endif
89
90 } 66 }
91 67
92 #endif // ENABLE(CONTEXT_MENUS) 68 #endif // ENABLE(CONTEXT_MENUS)
93 #endif // ContextMenu_h 69 #endif // ContextMenu_h
OLDNEW
« no previous file with comments | « Source/WebCore/page/ContextMenuProvider.h ('k') | Source/WebCore/platform/ContextMenu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698