| 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/current_drag_operation_source.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; |
| 30 class CurrentDragOperation; |
| 29 class EventDispatcherDelegate; | 31 class EventDispatcherDelegate; |
| 30 class ServerWindow; | 32 class ServerWindow; |
| 33 class WindowTree; |
| 31 | 34 |
| 32 namespace test { | 35 namespace test { |
| 33 class EventDispatcherTestApi; | 36 class EventDispatcherTestApi; |
| 34 } | 37 } |
| 35 | 38 |
| 36 // Handles dispatching events to the right location as well as updating focus. | 39 // Handles dispatching events to the right location as well as updating focus. |
| 37 class EventDispatcher : public ServerWindowObserver { | 40 class EventDispatcher : public ServerWindowObserver { |
| 38 public: | 41 public: |
| 39 enum class AcceleratorMatchPhase { | 42 enum class AcceleratorMatchPhase { |
| 40 // Both pre and post should be considered. | 43 // Both pre and post should be considered. |
| (...skipping 27 matching lines...) Expand all Loading... |
| 68 // Setting capture can fail if the window is blocked by a modal window | 71 // Setting capture can fail if the window is blocked by a modal window |
| 69 // (indicated by returning |false|). | 72 // (indicated by returning |false|). |
| 70 bool SetCaptureWindow(ServerWindow* capture_window, | 73 bool SetCaptureWindow(ServerWindow* capture_window, |
| 71 ClientSpecificId client_id); | 74 ClientSpecificId client_id); |
| 72 | 75 |
| 73 // Id of the client that capture events are sent to. | 76 // Id of the client that capture events are sent to. |
| 74 ClientSpecificId capture_window_client_id() const { | 77 ClientSpecificId capture_window_client_id() const { |
| 75 return capture_window_client_id_; | 78 return capture_window_client_id_; |
| 76 } | 79 } |
| 77 | 80 |
| 81 void SetDragDropSourceWindow( |
| 82 CurrentDragOperationSource* drag_source, |
| 83 ServerWindow* window, |
| 84 mojo::Map<mojo::String, mojo::Array<uint8_t>> mime_data, |
| 85 uint32_t drag_operations); |
| 86 void EndDragDrop(); |
| 87 |
| 78 // Adds a system modal window. The window remains modal to system until it is | 88 // Adds a system modal window. The window remains modal to system until it is |
| 79 // destroyed. There can exist multiple system modal windows, in which case the | 89 // destroyed. There can exist multiple system modal windows, in which case the |
| 80 // one that is visible and added most recently or shown most recently would be | 90 // one that is visible and added most recently or shown most recently would be |
| 81 // the active one. | 91 // the active one. |
| 82 void AddSystemModalWindow(ServerWindow* window); | 92 void AddSystemModalWindow(ServerWindow* window); |
| 83 | 93 |
| 84 // Checks if |modal_window| is a visible modal window that blocks current | 94 // Checks if |modal_window| is a visible modal window that blocks current |
| 85 // capture window and if that's the case, releases the capture. | 95 // capture window and if that's the case, releases the capture. |
| 86 void ReleaseCaptureBlockedByModalWindow(const ServerWindow* modal_window); | 96 void ReleaseCaptureBlockedByModalWindow(const ServerWindow* modal_window); |
| 87 | 97 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 ServerWindow* new_parent, | 219 ServerWindow* new_parent, |
| 210 ServerWindow* old_parent) override; | 220 ServerWindow* old_parent) override; |
| 211 void OnWindowVisibilityChanged(ServerWindow* window) override; | 221 void OnWindowVisibilityChanged(ServerWindow* window) override; |
| 212 void OnWindowDestroyed(ServerWindow* window) override; | 222 void OnWindowDestroyed(ServerWindow* window) override; |
| 213 | 223 |
| 214 EventDispatcherDelegate* delegate_; | 224 EventDispatcherDelegate* delegate_; |
| 215 | 225 |
| 216 ServerWindow* capture_window_; | 226 ServerWindow* capture_window_; |
| 217 ClientSpecificId capture_window_client_id_; | 227 ClientSpecificId capture_window_client_id_; |
| 218 | 228 |
| 229 std::unique_ptr<CurrentDragOperation> current_drag_drop_operation_; |
| 230 |
| 219 ModalWindowController modal_window_controller_; | 231 ModalWindowController modal_window_controller_; |
| 220 | 232 |
| 221 bool mouse_button_down_; | 233 bool mouse_button_down_; |
| 222 ServerWindow* mouse_cursor_source_window_; | 234 ServerWindow* mouse_cursor_source_window_; |
| 223 bool mouse_cursor_in_non_client_area_; | 235 bool mouse_cursor_in_non_client_area_; |
| 224 | 236 |
| 225 // The on screen location of the mouse pointer. This can be outside the | 237 // The on screen location of the mouse pointer. This can be outside the |
| 226 // bounds of |mouse_cursor_source_window_|, which can capture the cursor. | 238 // bounds of |mouse_cursor_source_window_|, which can capture the cursor. |
| 227 gfx::Point mouse_pointer_last_location_; | 239 gfx::Point mouse_pointer_last_location_; |
| 228 | 240 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 244 AcceleratorMatchPhase::ANY; | 256 AcceleratorMatchPhase::ANY; |
| 245 #endif | 257 #endif |
| 246 | 258 |
| 247 DISALLOW_COPY_AND_ASSIGN(EventDispatcher); | 259 DISALLOW_COPY_AND_ASSIGN(EventDispatcher); |
| 248 }; | 260 }; |
| 249 | 261 |
| 250 } // namespace ws | 262 } // namespace ws |
| 251 } // namespace ui | 263 } // namespace ui |
| 252 | 264 |
| 253 #endif // SERVICES_UI_WS_EVENT_DISPATCHER_H_ | 265 #endif // SERVICES_UI_WS_EVENT_DISPATCHER_H_ |
| OLD | NEW |