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