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 "ash/shell.h" | 5 #include "ash/shell.h" |
6 #include "ash/shell_window_ids.h" | 6 #include "ash/shell_window_ids.h" |
7 #include "ash/test/ash_test_base.h" | 7 #include "ash/test/ash_test_base.h" |
8 #include "ash/test/shell_test_api.h" | 8 #include "ash/test/shell_test_api.h" |
9 #include "ash/test/test_activation_delegate.h" | 9 #include "ash/test/test_activation_delegate.h" |
10 #include "ash/wm/activation_controller.h" | 10 #include "ash/wm/activation_controller.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 55 |
56 // Overridden from ui::EventHandler: | 56 // Overridden from ui::EventHandler: |
57 virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE { | 57 virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE { |
58 aura::test::TestEventHandler::OnKeyEvent(event); | 58 aura::test::TestEventHandler::OnKeyEvent(event); |
59 if (key_result_ & ui::ER_HANDLED) | 59 if (key_result_ & ui::ER_HANDLED) |
60 event->SetHandled(); | 60 event->SetHandled(); |
61 if (key_result_ & ui::ER_CONSUMED) | 61 if (key_result_ & ui::ER_CONSUMED) |
62 event->StopPropagation(); | 62 event->StopPropagation(); |
63 } | 63 } |
64 | 64 |
65 virtual ui::EventResult OnMouseEvent(ui::MouseEvent* event) OVERRIDE { | 65 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE { |
66 ui::EventResult result = aura::test::TestEventHandler::OnMouseEvent(event); | 66 aura::test::TestEventHandler::OnMouseEvent(event); |
67 return mouse_result_ == ui::ER_UNHANDLED ? result : mouse_result_; | 67 if (mouse_result_ & ui::ER_HANDLED) |
| 68 event->SetHandled(); |
| 69 if (mouse_result_ & ui::ER_CONSUMED) |
| 70 event->StopPropagation(); |
68 } | 71 } |
69 | 72 |
70 private: | 73 private: |
71 ui::EventResult key_result_; | 74 ui::EventResult key_result_; |
72 ui::EventResult mouse_result_; | 75 ui::EventResult mouse_result_; |
73 | 76 |
74 DISALLOW_COPY_AND_ASSIGN(CustomEventHandler); | 77 DISALLOW_COPY_AND_ASSIGN(CustomEventHandler); |
75 }; | 78 }; |
76 | 79 |
77 } // namespace | 80 } // namespace |
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
684 EXPECT_TRUE(cursor_manager->IsCursorVisible()); | 687 EXPECT_TRUE(cursor_manager->IsCursorVisible()); |
685 root_window->AsRootWindowHostDelegate()->OnHostTouchEvent(&touch_pressed2); | 688 root_window->AsRootWindowHostDelegate()->OnHostTouchEvent(&touch_pressed2); |
686 EXPECT_FALSE(cursor_manager->IsCursorVisible()); | 689 EXPECT_FALSE(cursor_manager->IsCursorVisible()); |
687 root_window->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse_moved); | 690 root_window->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse_moved); |
688 EXPECT_TRUE(cursor_manager->IsCursorVisible()); | 691 EXPECT_TRUE(cursor_manager->IsCursorVisible()); |
689 root_window->AsRootWindowHostDelegate()->OnHostTouchEvent(&touch_released2); | 692 root_window->AsRootWindowHostDelegate()->OnHostTouchEvent(&touch_released2); |
690 EXPECT_TRUE(cursor_manager->IsCursorVisible()); | 693 EXPECT_TRUE(cursor_manager->IsCursorVisible()); |
691 } | 694 } |
692 | 695 |
693 } // namespace ash | 696 } // namespace ash |
OLD | NEW |