OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "config.h" | |
6 #include "core/html/CustomContextMenuProvider.h" | |
7 | |
8 #include "core/dom/Document.h" | |
9 #include "core/events/EventDispatcher.h" | |
10 #include "core/events/MouseEvent.h" | |
11 #include "core/html/HTMLMenuElement.h" | |
12 #include "platform/ContextMenu.h" | |
13 | |
14 namespace WebCore { | |
Inactive
2014/07/23 14:19:07
blink
pals
2014/07/24 10:49:25
Done.
| |
15 | |
16 CustomContextMenuProvider::~CustomContextMenuProvider() | |
17 { | |
18 } | |
19 | |
20 void CustomContextMenuProvider::populateContextMenu(ContextMenu* menu) | |
21 { | |
22 for (size_t i = 0; i < m_items.size(); ++i) | |
23 menu->appendItem(m_items[i]); | |
24 } | |
25 | |
26 void CustomContextMenuProvider::contextMenuItemSelected(const ContextMenuItem* i tem) | |
27 { | |
28 if (!m_menu) | |
Inactive
2014/07/23 14:19:07
Just to confirm, can this happen or not? If it sho
pals
2014/07/24 10:49:26
This can happen if user has been shown context men
| |
29 return; | |
30 | |
31 if (HTMLElement* element = m_menu->menuItemAt(item->action())) { | |
Inactive
2014/07/23 14:19:07
HTMLMenuItemElement*
pals
2014/07/24 10:49:26
Done.
| |
32 RefPtrWillBeRawPtr<SimulatedMouseEvent> click = SimulatedMouseEvent::cre ate(EventTypeNames::click, m_menu->document().domWindow(), Event::create()); | |
33 click->setRelatedTarget(m_menu->subjectElement()); | |
34 EventDispatcher::dispatchEvent(element, EventDispatchMediator::create(cl ick.release())); | |
35 } | |
36 } | |
37 | |
38 } // namespace | |
Inactive
2014/07/23 14:19:07
blink
pals
2014/07/24 10:49:26
Done.
| |
OLD | NEW |