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 #ifndef ASH_WM_WORKSPACE_WORKSPACE_EVENT_HANDLER_H_ | 5 #ifndef ASH_COMMON_WM_WORKSPACE_WORKSPACE_EVENT_HANDLER_H_ |
6 #define ASH_WM_WORKSPACE_WORKSPACE_EVENT_HANDLER_H_ | 6 #define ASH_COMMON_WM_WORKSPACE_WORKSPACE_EVENT_HANDLER_H_ |
7 | 7 |
| 8 #include "ash/ash_export.h" |
8 #include "ash/common/wm/workspace/multi_window_resize_controller.h" | 9 #include "ash/common/wm/workspace/multi_window_resize_controller.h" |
9 #include "base/macros.h" | 10 #include "base/macros.h" |
10 #include "ui/events/event_handler.h" | 11 |
| 12 namespace ui { |
| 13 class GestureEvent; |
| 14 class MouseEvent; |
| 15 } |
11 | 16 |
12 namespace ash { | 17 namespace ash { |
| 18 class WmWindow; |
13 class WorkspaceEventHandlerTestHelper; | 19 class WorkspaceEventHandlerTestHelper; |
14 | 20 |
15 namespace wm { | 21 namespace wm { |
16 class WindowState; | 22 class WindowState; |
17 } | 23 } |
18 | 24 |
19 class WorkspaceEventHandler : public ui::EventHandler { | 25 // ui::EventHandler like class installed on the window associated with |
| 26 // WorkspaceLayoutManager. This handles various events happening on child |
| 27 // windows and takes appropriate action. It is expected the environment specific |
| 28 // file calls OnMouseEvent()/OnGestureEvent() as appropriate. |
| 29 class ASH_EXPORT WorkspaceEventHandler { |
20 public: | 30 public: |
21 WorkspaceEventHandler(); | 31 WorkspaceEventHandler(); |
22 ~WorkspaceEventHandler() override; | 32 virtual ~WorkspaceEventHandler(); |
23 | 33 |
24 // ui::EventHandler: | 34 void OnMouseEvent(ui::MouseEvent* event, WmWindow* target); |
25 void OnMouseEvent(ui::MouseEvent* event) override; | 35 void OnGestureEvent(ui::GestureEvent* event, WmWindow* target); |
26 void OnGestureEvent(ui::GestureEvent* event) override; | |
27 | 36 |
28 private: | 37 private: |
29 friend class WorkspaceEventHandlerTestHelper; | 38 friend class WorkspaceEventHandlerTestHelper; |
30 | 39 |
31 // Determines if |event| corresponds to a double click on either the top or | 40 // Determines if |event| corresponds to a double click on either the top or |
32 // bottom vertical resize edge, and if so toggles the vertical height of the | 41 // bottom vertical resize edge, and if so toggles the vertical height of the |
33 // window between its restored state and the full available height of the | 42 // window between its restored state and the full available height of the |
34 // workspace. | 43 // workspace. |
35 void HandleVerticalResizeDoubleClick(wm::WindowState* window_state, | 44 void HandleVerticalResizeDoubleClick(wm::WindowState* window_state, |
36 ui::MouseEvent* event); | 45 ui::MouseEvent* event); |
37 | 46 |
38 MultiWindowResizeController multi_window_resize_controller_; | 47 MultiWindowResizeController multi_window_resize_controller_; |
39 | 48 |
40 // The non-client component for the target of a MouseEvent or GestureEvent. | 49 // The non-client component for the target of a MouseEvent or GestureEvent. |
41 // Events can be destructive to the window tree, which can cause the | 50 // Events can be destructive to the window tree, which can cause the |
42 // component of a ui::EF_IS_DOUBLE_CLICK event to no longer be the same as | 51 // component of a ui::EF_IS_DOUBLE_CLICK event to no longer be the same as |
43 // that of the initial click. Acting on a double click should only occur for | 52 // that of the initial click. Acting on a double click should only occur for |
44 // matching components. This will be set for left clicks, and tap events. | 53 // matching components. This will be set for left clicks, and tap events. |
45 int click_component_; | 54 int click_component_; |
46 | 55 |
47 DISALLOW_COPY_AND_ASSIGN(WorkspaceEventHandler); | 56 DISALLOW_COPY_AND_ASSIGN(WorkspaceEventHandler); |
48 }; | 57 }; |
49 | 58 |
50 } // namespace ash | 59 } // namespace ash |
51 | 60 |
52 #endif // ASH_WM_WORKSPACE_WORKSPACE_EVENT_HANDLER_H_ | 61 #endif // ASH_COMMON_WM_WORKSPACE_WORKSPACE_EVENT_HANDLER_H_ |
OLD | NEW |