| 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/UserGestureIndicator.h" | 7 #include "core/dom/UserGestureIndicator.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" |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 return ToWebLocalFrameBase(LocalRoot())->ViewImpl(); | 231 return ToWebLocalFrameBase(LocalRoot())->ViewImpl(); |
| 232 } | 232 } |
| 233 | 233 |
| 234 Page* WebFrameWidgetBase::GetPage() const { | 234 Page* WebFrameWidgetBase::GetPage() const { |
| 235 return View()->GetPage(); | 235 return View()->GetPage(); |
| 236 } | 236 } |
| 237 | 237 |
| 238 void WebFrameWidgetBase::DidAcquirePointerLock() { | 238 void WebFrameWidgetBase::DidAcquirePointerLock() { |
| 239 GetPage()->GetPointerLockController().DidAcquirePointerLock(); | 239 GetPage()->GetPointerLockController().DidAcquirePointerLock(); |
| 240 | 240 |
| 241 LocalFrame* focusedFrame = FocusedLocalFrameInWidget(); | 241 LocalFrame* focusedFrame = FocusedLocalFrame(); |
| 242 if (focusedFrame) { | 242 if (focusedFrame) { |
| 243 focusedFrame->GetEventHandler().ReleaseMousePointerCapture(); | 243 focusedFrame->GetEventHandler().ReleaseMousePointerCapture(); |
| 244 } | 244 } |
| 245 } | 245 } |
| 246 | 246 |
| 247 void WebFrameWidgetBase::DidNotAcquirePointerLock() { | 247 void WebFrameWidgetBase::DidNotAcquirePointerLock() { |
| 248 GetPage()->GetPointerLockController().DidNotAcquirePointerLock(); | 248 GetPage()->GetPointerLockController().DidNotAcquirePointerLock(); |
| 249 } | 249 } |
| 250 | 250 |
| 251 void WebFrameWidgetBase::DidLosePointerLock() { | 251 void WebFrameWidgetBase::DidLosePointerLock() { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 262 // TODO(665924): Remove direct dispatches of mouse events from | 262 // TODO(665924): Remove direct dispatches of mouse events from |
| 263 // PointerLockController, instead passing them through EventHandler. | 263 // PointerLockController, instead passing them through EventHandler. |
| 264 void WebFrameWidgetBase::PointerLockMouseEvent( | 264 void WebFrameWidgetBase::PointerLockMouseEvent( |
| 265 const WebCoalescedInputEvent& coalesced_event) { | 265 const WebCoalescedInputEvent& coalesced_event) { |
| 266 const WebInputEvent& input_event = coalesced_event.Event(); | 266 const WebInputEvent& input_event = coalesced_event.Event(); |
| 267 const WebMouseEvent& mouse_event = | 267 const WebMouseEvent& mouse_event = |
| 268 static_cast<const WebMouseEvent&>(input_event); | 268 static_cast<const WebMouseEvent&>(input_event); |
| 269 WebMouseEvent transformed_event = TransformWebMouseEvent( | 269 WebMouseEvent transformed_event = TransformWebMouseEvent( |
| 270 ToWebLocalFrameBase(LocalRoot())->GetFrameView(), mouse_event); | 270 ToWebLocalFrameBase(LocalRoot())->GetFrameView(), mouse_event); |
| 271 | 271 |
| 272 LocalFrame* focusedFrame = FocusedLocalFrameInWidget(); | 272 LocalFrame* focusedFrame = FocusedLocalFrame(); |
| 273 if (focusedFrame) { | 273 if (focusedFrame) { |
| 274 focusedFrame->GetEventHandler().ProcessPendingPointerCaptureForPointerLock( | 274 focusedFrame->GetEventHandler().ProcessPendingPointerCaptureForPointerLock( |
| 275 transformed_event); | 275 transformed_event); |
| 276 } | 276 } |
| 277 | 277 |
| 278 std::unique_ptr<UserGestureIndicator> gesture_indicator; | 278 std::unique_ptr<UserGestureIndicator> gesture_indicator; |
| 279 AtomicString event_type; | 279 AtomicString event_type; |
| 280 switch (input_event.GetType()) { | 280 switch (input_event.GetType()) { |
| 281 case WebInputEvent::kMouseDown: | 281 case WebInputEvent::kMouseDown: |
| 282 event_type = EventTypeNames::mousedown; | 282 event_type = EventTypeNames::mousedown; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 { | 316 { |
| 317 ContextMenuAllowedScope scope; | 317 ContextMenuAllowedScope scope; |
| 318 if (LocalFrame* focused_frame = | 318 if (LocalFrame* focused_frame = |
| 319 GetPage()->GetFocusController().FocusedFrame()) { | 319 GetPage()->GetFocusController().FocusedFrame()) { |
| 320 focused_frame->GetEventHandler().ShowNonLocatedContextMenu(nullptr, | 320 focused_frame->GetEventHandler().ShowNonLocatedContextMenu(nullptr, |
| 321 source_type); | 321 source_type); |
| 322 } | 322 } |
| 323 } | 323 } |
| 324 } | 324 } |
| 325 | 325 |
| 326 LocalFrame* WebFrameWidgetBase::FocusedLocalFrameInWidget() const { | 326 LocalFrame* WebFrameWidgetBase::FocusedLocalFrame() const { |
| 327 LocalFrame* frame = GetPage()->GetFocusController().FocusedFrame(); | 327 LocalFrame* frame = GetPage()->GetFocusController().FocusedFrame(); |
| 328 return (frame && frame->LocalFrameRoot() == ToCoreFrame(LocalRoot())) | 328 return (frame && frame->LocalFrameRoot() == ToCoreFrame(LocalRoot())) |
| 329 ? frame | 329 ? frame |
| 330 : nullptr; | 330 : nullptr; |
| 331 } | 331 } |
| 332 | 332 |
| 333 } // namespace blink | 333 } // namespace blink |
| OLD | NEW |