OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/frame/WebFrameWidgetBase.h" | 5 #include "core/frame/WebFrameWidgetBase.h" |
6 | 6 |
7 #include "core/dom/DocumentUserGestureToken.h" | 7 #include "core/dom/DocumentUserGestureToken.h" |
8 #include "core/events/WebInputEventConversion.h" | 8 #include "core/events/WebInputEventConversion.h" |
9 #include "core/exported/WebViewBase.h" | 9 #include "core/exported/WebViewBase.h" |
10 #include "core/frame/LocalFrameView.h" | 10 #include "core/frame/LocalFrameView.h" |
11 #include "core/frame/VisualViewport.h" | 11 #include "core/frame/VisualViewport.h" |
12 #include "core/frame/WebLocalFrameBase.h" | 12 #include "core/frame/WebLocalFrameBase.h" |
| 13 #include "core/input/ContextMenuAllowedScope.h" |
13 #include "core/input/EventHandler.h" | 14 #include "core/input/EventHandler.h" |
| 15 #include "core/page/ContextMenuController.h" |
14 #include "core/page/DragActions.h" | 16 #include "core/page/DragActions.h" |
15 #include "core/page/DragController.h" | 17 #include "core/page/DragController.h" |
16 #include "core/page/DragData.h" | 18 #include "core/page/DragData.h" |
17 #include "core/page/DragSession.h" | 19 #include "core/page/DragSession.h" |
| 20 #include "core/page/FocusController.h" |
18 #include "core/page/Page.h" | 21 #include "core/page/Page.h" |
19 #include "core/page/PointerLockController.h" | 22 #include "core/page/PointerLockController.h" |
20 #include "platform/UserGestureIndicator.h" | 23 #include "platform/UserGestureIndicator.h" |
21 #include "public/web/WebWidgetClient.h" | 24 #include "public/web/WebWidgetClient.h" |
22 | 25 |
23 namespace blink { | 26 namespace blink { |
24 | 27 |
25 namespace { | 28 namespace { |
26 | 29 |
27 // Helper to get LocalFrame* from WebLocalFrame*. | 30 // Helper to get LocalFrame* from WebLocalFrame*. |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 const WebMouseEvent& mouse_event = static_cast<const WebMouseEvent&>(event); | 280 const WebMouseEvent& mouse_event = static_cast<const WebMouseEvent&>(event); |
278 | 281 |
279 if (GetPage()) { | 282 if (GetPage()) { |
280 WebMouseEvent transformed_event = TransformWebMouseEvent( | 283 WebMouseEvent transformed_event = TransformWebMouseEvent( |
281 ToWebLocalFrameBase(LocalRoot())->GetFrameView(), mouse_event); | 284 ToWebLocalFrameBase(LocalRoot())->GetFrameView(), mouse_event); |
282 GetPage()->GetPointerLockController().DispatchLockedMouseEvent( | 285 GetPage()->GetPointerLockController().DispatchLockedMouseEvent( |
283 transformed_event, event_type); | 286 transformed_event, event_type); |
284 } | 287 } |
285 } | 288 } |
286 | 289 |
| 290 void WebFrameWidgetBase::ShowContextMenu(WebMenuSourceType source_type) { |
| 291 if (!GetPage()) |
| 292 return; |
| 293 |
| 294 GetPage()->GetContextMenuController().ClearContextMenu(); |
| 295 { |
| 296 ContextMenuAllowedScope scope; |
| 297 if (LocalFrame* focused_frame = |
| 298 GetPage()->GetFocusController().FocusedFrame()) { |
| 299 focused_frame->GetEventHandler().ShowNonLocatedContextMenu(nullptr, |
| 300 source_type); |
| 301 } |
| 302 } |
| 303 } |
| 304 |
287 } // namespace blink | 305 } // namespace blink |
OLD | NEW |