OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/views/widget/native_widget_aura.h" | 5 #include "ui/views/widget/native_widget_aura.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "third_party/skia/include/core/SkRegion.h" | 9 #include "third_party/skia/include/core/SkRegion.h" |
10 #include "ui/aura/client/activation_change_observer.h" | 10 #include "ui/aura/client/activation_change_observer.h" |
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
785 if (root_layer_iter > child_layer_iter) | 785 if (root_layer_iter > child_layer_iter) |
786 return false; | 786 return false; |
787 } | 787 } |
788 } | 788 } |
789 return true; | 789 return true; |
790 } | 790 } |
791 | 791 |
792 bool NativeWidgetAura::OnMouseEvent(ui::MouseEvent* event) { | 792 bool NativeWidgetAura::OnMouseEvent(ui::MouseEvent* event) { |
793 DCHECK(window_->IsVisible()); | 793 DCHECK(window_->IsVisible()); |
794 if (event->type() == ui::ET_MOUSEWHEEL) { | 794 if (event->type() == ui::ET_MOUSEWHEEL) { |
795 MouseWheelEvent wheel_event(event); | 795 ui::MouseWheelEvent wheel_event(event); |
796 return delegate_->OnMouseEvent(wheel_event); | 796 return delegate_->OnMouseEvent(wheel_event); |
797 } | 797 } |
798 if (event->type() == ui::ET_SCROLL) { | 798 if (event->type() == ui::ET_SCROLL) { |
799 ScrollEvent scroll_event(static_cast<ui::ScrollEvent*>(event)); | 799 if (delegate_->OnMouseEvent(*event)) |
800 if (delegate_->OnMouseEvent(scroll_event)) | |
801 return true; | 800 return true; |
802 | 801 |
803 // Convert unprocessed scroll events into wheel events. | 802 // Convert unprocessed scroll events into wheel events. |
804 MouseWheelEvent wheel_event(scroll_event); | 803 ui::MouseWheelEvent wheel_event(*static_cast<ui::ScrollEvent*>(event)); |
805 return delegate_->OnMouseEvent(wheel_event); | 804 return delegate_->OnMouseEvent(wheel_event); |
806 } | 805 } |
807 if (tooltip_manager_.get()) | 806 if (tooltip_manager_.get()) |
808 tooltip_manager_->UpdateTooltip(); | 807 tooltip_manager_->UpdateTooltip(); |
809 return delegate_->OnMouseEvent(*event); | 808 return delegate_->OnMouseEvent(*event); |
810 } | 809 } |
811 | 810 |
812 ui::TouchStatus NativeWidgetAura::OnTouchEvent(ui::TouchEvent* event) { | 811 ui::TouchStatus NativeWidgetAura::OnTouchEvent(ui::TouchEvent* event) { |
813 DCHECK(window_->IsVisible()); | 812 DCHECK(window_->IsVisible()); |
814 TouchEvent touch_event(event); | 813 return delegate_->OnTouchEvent(*event); |
815 return delegate_->OnTouchEvent(touch_event); | |
816 } | 814 } |
817 | 815 |
818 ui::GestureStatus NativeWidgetAura::OnGestureEvent( | 816 ui::GestureStatus NativeWidgetAura::OnGestureEvent( |
819 ui::GestureEvent* event) { | 817 ui::GestureEvent* event) { |
820 DCHECK(window_->IsVisible()); | 818 DCHECK(window_->IsVisible()); |
821 GestureEvent gesture_event(event); | 819 return delegate_->OnGestureEvent(*event); |
822 return delegate_->OnGestureEvent(gesture_event); | |
823 } | 820 } |
824 | 821 |
825 bool NativeWidgetAura::CanFocus() { | 822 bool NativeWidgetAura::CanFocus() { |
826 return can_activate_; | 823 return can_activate_; |
827 } | 824 } |
828 | 825 |
829 void NativeWidgetAura::OnCaptureLost() { | 826 void NativeWidgetAura::OnCaptureLost() { |
830 delegate_->OnMouseCaptureLost(); | 827 delegate_->OnMouseCaptureLost(); |
831 } | 828 } |
832 | 829 |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1046 return aura::Env::GetInstance()->is_mouse_button_down(); | 1043 return aura::Env::GetInstance()->is_mouse_button_down(); |
1047 } | 1044 } |
1048 | 1045 |
1049 // static | 1046 // static |
1050 bool NativeWidgetPrivate::IsTouchDown() { | 1047 bool NativeWidgetPrivate::IsTouchDown() { |
1051 return aura::Env::GetInstance()->is_touch_down(); | 1048 return aura::Env::GetInstance()->is_touch_down(); |
1052 } | 1049 } |
1053 | 1050 |
1054 } // namespace internal | 1051 } // namespace internal |
1055 } // namespace views | 1052 } // namespace views |
OLD | NEW |