OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 #import "ui/views/cocoa/bridged_content_view.h" | 5 #import "ui/views/cocoa/bridged_content_view.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #import "base/mac/mac_util.h" | 8 #import "base/mac/mac_util.h" |
9 #import "base/mac/scoped_nsobject.h" | 9 #import "base/mac/scoped_nsobject.h" |
10 #import "base/mac/sdk_forward_declarations.h" | 10 #import "base/mac/sdk_forward_declarations.h" |
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
793 } | 793 } |
794 | 794 |
795 - (void)scrollWheel:(NSEvent*)theEvent { | 795 - (void)scrollWheel:(NSEvent*)theEvent { |
796 if (!hostedView_) | 796 if (!hostedView_) |
797 return; | 797 return; |
798 | 798 |
799 ui::ScrollEvent event(theEvent); | 799 ui::ScrollEvent event(theEvent); |
800 hostedView_->GetWidget()->OnScrollEvent(&event); | 800 hostedView_->GetWidget()->OnScrollEvent(&event); |
801 } | 801 } |
802 | 802 |
803 // Called when we get a three-finger swipe, and they're enabled in System | |
tapted
2017/02/13 11:26:25
I think the pref can be set to 2-fingers or 3-fing
themblsha
2017/02/15 17:35:34
Yep. But two-finger swipes are already handled by
tapted
2017/02/15 22:25:52
ohh interesting. We'll eventually want to remove H
| |
804 // Preferences. | |
805 - (void)swipeWithEvent:(NSEvent*)event { | |
tapted
2017/02/13 11:26:25
This should bail out early when hostedView_ is nul
themblsha
2017/02/15 17:35:34
Done.
| |
806 ui::GestureEventDetails swipe_details(ui::ET_GESTURE_SWIPE, [event deltaX], | |
tapted
2017/02/13 11:26:24
EventTypeFromNative needs to be updated -- NSEvent
tapted
2017/02/13 11:26:25
swipe_details -> swipeDetails (This is between @fo
themblsha
2017/02/15 17:35:34
Done.
themblsha
2017/02/15 17:35:34
It's technically the same type of NSEvent that sta
tapted
2017/02/15 22:25:52
Acknowledged.
| |
807 [event deltaY]); | |
808 swipe_details.set_device_type(ui::GestureDeviceType::DEVICE_TOUCHPAD); | |
809 | |
tapted
2017/02/13 11:26:24
set_touch_points?
themblsha
2017/02/15 17:35:34
I don't think it's applicable to the instant three
tapted
2017/02/15 22:25:52
Acknowledged. (I'd also be fine with just setting
themblsha
2017/02/16 15:27:49
Ah. Okay, added setting it to `3` :-)
| |
810 gfx::PointF location = ui::EventLocationFromNative(event); | |
811 ui::GestureEvent gesture_event(location.x(), location.y(), | |
tapted
2017/02/13 11:26:25
gestureEvent, or just |event|
themblsha
2017/02/15 17:35:34
Done.
| |
812 [event modifierFlags], | |
tapted
2017/02/13 11:26:25
EventFlagsFromNative - we can't pass the Cocoa fla
themblsha
2017/02/15 17:35:34
Done.
| |
813 ui::EventTimeFromNative(event), swipe_details); | |
tapted
2017/02/13 11:26:24
-[NSEvent eventNumber] is probably an appropriate
themblsha
2017/02/15 17:35:34
This throws an exception: Invalid message sent to
tapted
2017/02/15 22:25:52
Can you comment about this? (~ "Note this uses the
themblsha
2017/02/16 15:27:49
Done.
| |
814 | |
815 views::NativeWidgetMac::GetBridgeForNativeWindow([self window]) | |
816 ->native_widget_mac() | |
817 ->GetWidget() | |
tapted
2017/02/13 11:26:24
hostedView_->GetWidget()
themblsha
2017/02/15 17:35:34
Done.
| |
818 ->OnGestureEvent(&gesture_event); | |
819 } | |
820 | |
803 - (void)quickLookWithEvent:(NSEvent*)theEvent { | 821 - (void)quickLookWithEvent:(NSEvent*)theEvent { |
804 if (!hostedView_) | 822 if (!hostedView_) |
805 return; | 823 return; |
806 | 824 |
807 const gfx::Point locationInContent = | 825 const gfx::Point locationInContent = |
808 gfx::ToFlooredPoint(ui::EventLocationFromNative(theEvent)); | 826 gfx::ToFlooredPoint(ui::EventLocationFromNative(theEvent)); |
809 views::View* target = hostedView_->GetEventHandlerForPoint(locationInContent); | 827 views::View* target = hostedView_->GetEventHandlerForPoint(locationInContent); |
810 if (!target) | 828 if (!target) |
811 return; | 829 return; |
812 | 830 |
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1457 return [hostedView_->GetNativeViewAccessible() accessibilityHitTest:point]; | 1475 return [hostedView_->GetNativeViewAccessible() accessibilityHitTest:point]; |
1458 } | 1476 } |
1459 | 1477 |
1460 - (id)accessibilityFocusedUIElement { | 1478 - (id)accessibilityFocusedUIElement { |
1461 if (!hostedView_) | 1479 if (!hostedView_) |
1462 return nil; | 1480 return nil; |
1463 return [hostedView_->GetNativeViewAccessible() accessibilityFocusedUIElement]; | 1481 return [hostedView_->GetNativeViewAccessible() accessibilityFocusedUIElement]; |
1464 } | 1482 } |
1465 | 1483 |
1466 @end | 1484 @end |
OLD | NEW |