OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. |
3 * Copyright (C) 2010 Igalia S.L | 3 * Copyright (C) 2010 Igalia S.L |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 { | 55 { |
56 } | 56 } |
57 | 57 |
58 PassOwnPtrWillBeRawPtr<ContextMenuController> ContextMenuController::create(Page
* page, ContextMenuClient* client) | 58 PassOwnPtrWillBeRawPtr<ContextMenuController> ContextMenuController::create(Page
* page, ContextMenuClient* client) |
59 { | 59 { |
60 return adoptPtrWillBeNoop(new ContextMenuController(page, client)); | 60 return adoptPtrWillBeNoop(new ContextMenuController(page, client)); |
61 } | 61 } |
62 | 62 |
63 void ContextMenuController::trace(Visitor* visitor) | 63 void ContextMenuController::trace(Visitor* visitor) |
64 { | 64 { |
| 65 visitor->trace(m_menuProvider); |
65 visitor->trace(m_hitTestResult); | 66 visitor->trace(m_hitTestResult); |
66 } | 67 } |
67 | 68 |
68 void ContextMenuController::clearContextMenu() | 69 void ContextMenuController::clearContextMenu() |
69 { | 70 { |
70 m_contextMenu.clear(); | 71 m_contextMenu.clear(); |
71 if (m_menuProvider) | 72 if (m_menuProvider) |
72 m_menuProvider->contextMenuCleared(); | 73 m_menuProvider->contextMenuCleared(); |
73 m_menuProvider = nullptr; | 74 m_menuProvider = nullptr; |
74 m_client->clearContextMenu(); | 75 m_client->clearContextMenu(); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 | 109 |
109 void ContextMenuController::handleContextMenuEvent(Event* event) | 110 void ContextMenuController::handleContextMenuEvent(Event* event) |
110 { | 111 { |
111 m_contextMenu = createContextMenu(event); | 112 m_contextMenu = createContextMenu(event); |
112 if (!m_contextMenu) | 113 if (!m_contextMenu) |
113 return; | 114 return; |
114 populateCustomContextMenu(*event); | 115 populateCustomContextMenu(*event); |
115 showContextMenu(event); | 116 showContextMenu(event); |
116 } | 117 } |
117 | 118 |
118 void ContextMenuController::showContextMenu(Event* event, PassRefPtr<ContextMenu
Provider> menuProvider) | 119 void ContextMenuController::showContextMenu(Event* event, PassRefPtrWillBeRawPtr
<ContextMenuProvider> menuProvider) |
119 { | 120 { |
120 m_menuProvider = menuProvider; | 121 m_menuProvider = menuProvider; |
121 | 122 |
122 m_contextMenu = createContextMenu(event); | 123 m_contextMenu = createContextMenu(event); |
123 if (!m_contextMenu) { | 124 if (!m_contextMenu) { |
124 clearContextMenu(); | 125 clearContextMenu(); |
125 return; | 126 return; |
126 } | 127 } |
127 | 128 |
128 m_menuProvider->populateContextMenu(m_contextMenu.get()); | 129 m_menuProvider->populateContextMenu(m_contextMenu.get()); |
129 showContextMenu(event); | 130 showContextMenu(event); |
130 } | 131 } |
131 | 132 |
132 void ContextMenuController::showContextMenuAtPoint(LocalFrame* frame, float x, f
loat y, PassRefPtr<ContextMenuProvider> menuProvider) | 133 void ContextMenuController::showContextMenuAtPoint(LocalFrame* frame, float x, f
loat y, PassRefPtrWillBeRawPtr<ContextMenuProvider> menuProvider) |
133 { | 134 { |
134 m_menuProvider = menuProvider; | 135 m_menuProvider = menuProvider; |
135 | 136 |
136 LayoutPoint location(x, y); | 137 LayoutPoint location(x, y); |
137 m_contextMenu = createContextMenu(frame, location); | 138 m_contextMenu = createContextMenu(frame, location); |
138 if (!m_contextMenu) { | 139 if (!m_contextMenu) { |
139 clearContextMenu(); | 140 clearContextMenu(); |
140 return; | 141 return; |
141 } | 142 } |
142 | 143 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 ASSERT(item->type() == ActionType || item->type() == CheckableActionType); | 183 ASSERT(item->type() == ActionType || item->type() == CheckableActionType); |
183 | 184 |
184 if (item->action() < ContextMenuItemBaseCustomTag || item->action() > Contex
tMenuItemLastCustomTag) | 185 if (item->action() < ContextMenuItemBaseCustomTag || item->action() > Contex
tMenuItemLastCustomTag) |
185 return; | 186 return; |
186 | 187 |
187 ASSERT(m_menuProvider); | 188 ASSERT(m_menuProvider); |
188 m_menuProvider->contextMenuItemSelected(item); | 189 m_menuProvider->contextMenuItemSelected(item); |
189 } | 190 } |
190 | 191 |
191 } // namespace blink | 192 } // namespace blink |
OLD | NEW |