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/desktop_aura/desktop_native_widget_aura.h" | 5 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "ui/aura/client/stacking_client.h" | 8 #include "ui/aura/client/stacking_client.h" |
9 #include "ui/aura/focus_manager.h" | 9 #include "ui/aura/focus_manager.h" |
10 #include "ui/aura/root_window.h" | 10 #include "ui/aura/root_window.h" |
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 | 559 |
560 native_widget_delegate_->OnKeyEvent(event); | 560 native_widget_delegate_->OnKeyEvent(event); |
561 if (event->handled()) | 561 if (event->handled()) |
562 return; | 562 return; |
563 | 563 |
564 if (GetWidget()->HasFocusManager() && | 564 if (GetWidget()->HasFocusManager() && |
565 !GetWidget()->GetFocusManager()->OnKeyEvent(*event)) | 565 !GetWidget()->GetFocusManager()->OnKeyEvent(*event)) |
566 event->SetHandled(); | 566 event->SetHandled(); |
567 } | 567 } |
568 | 568 |
569 ui::EventResult DesktopNativeWidgetAura::OnMouseEvent(ui::MouseEvent* event) { | 569 void DesktopNativeWidgetAura::OnMouseEvent(ui::MouseEvent* event) { |
570 DCHECK(window_->IsVisible()); | 570 DCHECK(window_->IsVisible()); |
571 if (event->type() == ui::ET_MOUSEWHEEL) { | 571 if (event->type() == ui::ET_MOUSEWHEEL) { |
572 return native_widget_delegate_->OnMouseEvent(*event) ? | 572 native_widget_delegate_->OnMouseEvent(event); |
573 ui::ER_HANDLED : ui::ER_UNHANDLED; | 573 if (event->handled()) |
| 574 return; |
574 } | 575 } |
575 | 576 |
576 return native_widget_delegate_->OnMouseEvent(*event) ? | 577 native_widget_delegate_->OnMouseEvent(event); |
577 ui::ER_HANDLED : ui::ER_UNHANDLED; | |
578 } | 578 } |
579 | 579 |
580 void DesktopNativeWidgetAura::OnScrollEvent(ui::ScrollEvent* event) { | 580 void DesktopNativeWidgetAura::OnScrollEvent(ui::ScrollEvent* event) { |
581 if (event->type() == ui::ET_SCROLL) { | 581 if (event->type() == ui::ET_SCROLL) { |
582 native_widget_delegate_->OnScrollEvent(event); | 582 native_widget_delegate_->OnScrollEvent(event); |
583 if (event->handled()) | 583 if (event->handled()) |
584 return; | 584 return; |
585 | 585 |
586 // Convert unprocessed scroll events into wheel events. | 586 // Convert unprocessed scroll events into wheel events. |
587 ui::MouseWheelEvent mwe(*static_cast<ui::ScrollEvent*>(event)); | 587 ui::MouseWheelEvent mwe(*static_cast<ui::ScrollEvent*>(event)); |
588 if (native_widget_delegate_->OnMouseEvent(mwe)) | 588 native_widget_delegate_->OnMouseEvent(&mwe); |
| 589 if (mwe.handled()) |
589 event->SetHandled(); | 590 event->SetHandled(); |
590 } else { | 591 } else { |
591 native_widget_delegate_->OnScrollEvent(event); | 592 native_widget_delegate_->OnScrollEvent(event); |
592 } | 593 } |
593 } | 594 } |
594 | 595 |
595 void DesktopNativeWidgetAura::OnTouchEvent(ui::TouchEvent* event) { | 596 void DesktopNativeWidgetAura::OnTouchEvent(ui::TouchEvent* event) { |
596 native_widget_delegate_->OnTouchEvent(event); | 597 native_widget_delegate_->OnTouchEvent(event); |
597 } | 598 } |
598 | 599 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
697 drop_helper_->OnDragExit(); | 698 drop_helper_->OnDragExit(); |
698 } | 699 } |
699 | 700 |
700 int DesktopNativeWidgetAura::OnPerformDrop(const ui::DropTargetEvent& event) { | 701 int DesktopNativeWidgetAura::OnPerformDrop(const ui::DropTargetEvent& event) { |
701 DCHECK(drop_helper_.get() != NULL); | 702 DCHECK(drop_helper_.get() != NULL); |
702 return drop_helper_->OnDrop(event.data(), event.location(), | 703 return drop_helper_->OnDrop(event.data(), event.location(), |
703 last_drop_operation_); | 704 last_drop_operation_); |
704 } | 705 } |
705 | 706 |
706 } // namespace views | 707 } // namespace views |
OLD | NEW |