| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 SERVICES_UI_WS_EVENT_DISPATCHER_H_ | 5 #ifndef SERVICES_UI_WS_EVENT_DISPATCHER_H_ |
| 6 #define SERVICES_UI_WS_EVENT_DISPATCHER_H_ | 6 #define SERVICES_UI_WS_EVENT_DISPATCHER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <utility> | 12 #include <utility> |
| 13 | 13 |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "services/ui/common/types.h" | 15 #include "services/ui/common/types.h" |
| 16 #include "services/ui/public/interfaces/event_matcher.mojom.h" | 16 #include "services/ui/public/interfaces/event_matcher.mojom.h" |
| 17 #include "services/ui/ws/drag_cursor_updater.h" |
| 17 #include "services/ui/ws/modal_window_controller.h" | 18 #include "services/ui/ws/modal_window_controller.h" |
| 18 #include "services/ui/ws/server_window_observer.h" | 19 #include "services/ui/ws/server_window_observer.h" |
| 19 #include "ui/gfx/geometry/rect_f.h" | 20 #include "ui/gfx/geometry/rect_f.h" |
| 20 | 21 |
| 21 namespace ui { | 22 namespace ui { |
| 22 class Event; | 23 class Event; |
| 23 class KeyEvent; | 24 class KeyEvent; |
| 24 class LocatedEvent; | 25 class LocatedEvent; |
| 25 | 26 |
| 26 namespace ws { | 27 namespace ws { |
| 27 | 28 |
| 28 class Accelerator; | 29 class Accelerator; |
| 29 class DragController; | 30 class DragController; |
| 30 class DragSource; | 31 class DragSource; |
| 31 class DragTargetConnection; | 32 class DragTargetConnection; |
| 32 class EventDispatcherDelegate; | 33 class EventDispatcherDelegate; |
| 33 class ServerWindow; | 34 class ServerWindow; |
| 34 class WindowTree; | 35 class WindowTree; |
| 35 | 36 |
| 36 namespace test { | 37 namespace test { |
| 37 class EventDispatcherTestApi; | 38 class EventDispatcherTestApi; |
| 38 } | 39 } |
| 39 | 40 |
| 40 // Handles dispatching events to the right location as well as updating focus. | 41 // Handles dispatching events to the right location as well as updating focus. |
| 41 class EventDispatcher : public ServerWindowObserver { | 42 class EventDispatcher : public ServerWindowObserver, public DragCursorUpdater { |
| 42 public: | 43 public: |
| 43 enum class AcceleratorMatchPhase { | 44 enum class AcceleratorMatchPhase { |
| 44 // Both pre and post should be considered. | 45 // Both pre and post should be considered. |
| 45 ANY, | 46 ANY, |
| 46 | 47 |
| 47 // PRE_TARGETs are not considered, only the actual target and any | 48 // PRE_TARGETs are not considered, only the actual target and any |
| 48 // accelerators registered with POST_TARGET. | 49 // accelerators registered with POST_TARGET. |
| 49 POST_ONLY, | 50 POST_ONLY, |
| 50 }; | 51 }; |
| 51 | 52 |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 // |window|. |window| may be null. | 225 // |window|. |window| may be null. |
| 225 void CancelImplicitCaptureExcept(ServerWindow* window); | 226 void CancelImplicitCaptureExcept(ServerWindow* window); |
| 226 | 227 |
| 227 // ServerWindowObserver: | 228 // ServerWindowObserver: |
| 228 void OnWillChangeWindowHierarchy(ServerWindow* window, | 229 void OnWillChangeWindowHierarchy(ServerWindow* window, |
| 229 ServerWindow* new_parent, | 230 ServerWindow* new_parent, |
| 230 ServerWindow* old_parent) override; | 231 ServerWindow* old_parent) override; |
| 231 void OnWindowVisibilityChanged(ServerWindow* window) override; | 232 void OnWindowVisibilityChanged(ServerWindow* window) override; |
| 232 void OnWindowDestroyed(ServerWindow* window) override; | 233 void OnWindowDestroyed(ServerWindow* window) override; |
| 233 | 234 |
| 235 // DragCursorUpdater: |
| 236 void OnDragCursorUpdated() override; |
| 237 |
| 234 EventDispatcherDelegate* delegate_; | 238 EventDispatcherDelegate* delegate_; |
| 235 | 239 |
| 236 ServerWindow* capture_window_; | 240 ServerWindow* capture_window_; |
| 237 ClientSpecificId capture_window_client_id_; | 241 ClientSpecificId capture_window_client_id_; |
| 238 | 242 |
| 239 std::unique_ptr<DragController> drag_controller_; | 243 std::unique_ptr<DragController> drag_controller_; |
| 240 | 244 |
| 241 ModalWindowController modal_window_controller_; | 245 ModalWindowController modal_window_controller_; |
| 242 | 246 |
| 243 bool mouse_button_down_; | 247 bool mouse_button_down_; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 266 AcceleratorMatchPhase::ANY; | 270 AcceleratorMatchPhase::ANY; |
| 267 #endif | 271 #endif |
| 268 | 272 |
| 269 DISALLOW_COPY_AND_ASSIGN(EventDispatcher); | 273 DISALLOW_COPY_AND_ASSIGN(EventDispatcher); |
| 270 }; | 274 }; |
| 271 | 275 |
| 272 } // namespace ws | 276 } // namespace ws |
| 273 } // namespace ui | 277 } // namespace ui |
| 274 | 278 |
| 275 #endif // SERVICES_UI_WS_EVENT_DISPATCHER_H_ | 279 #endif // SERVICES_UI_WS_EVENT_DISPATCHER_H_ |
| OLD | NEW |