| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_DRAG_CONTROLLER_H_ | 5 #ifndef SERVICES_UI_WS_DRAG_CONTROLLER_H_ |
| 6 #define SERVICES_UI_WS_DRAG_CONTROLLER_H_ | 6 #define SERVICES_UI_WS_DRAG_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 9 #include "services/ui/common/types.h" | 9 #include "services/ui/common/types.h" |
| 10 #include "services/ui/ws/ids.h" | 10 #include "services/ui/ws/ids.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 void OnWillDestroyDragTargetConnection(DragTargetConnection* connection); | 45 void OnWillDestroyDragTargetConnection(DragTargetConnection* connection); |
| 46 | 46 |
| 47 private: | 47 private: |
| 48 friend class test::DragControllerTestApi; | 48 friend class test::DragControllerTestApi; |
| 49 enum class OperationType { NONE, ENTER, OVER, LEAVE, DROP }; | 49 enum class OperationType { NONE, ENTER, OVER, LEAVE, DROP }; |
| 50 struct Operation; | 50 struct Operation; |
| 51 struct WindowState; | 51 struct WindowState; |
| 52 | 52 |
| 53 // Notifies all windows we messaged that the drag is finished, and then tell | 53 // Notifies all windows we messaged that the drag is finished, and then tell |
| 54 // |source| the result. | 54 // |source| the result. |
| 55 void MessageDragCompleted(bool success); | 55 void MessageDragCompleted(bool success, uint32_t action_taken); |
| 56 | 56 |
| 57 // Returns the number of events on |window|. A value of 1 means that there's | 57 // Returns the number of events on |window|. A value of 1 means that there's |
| 58 // a single event outstanding that we're waiting for a response from the | 58 // a single event outstanding that we're waiting for a response from the |
| 59 // client, all values over 1 are queued and will be dispatched when the event | 59 // client, all values over 1 are queued and will be dispatched when the event |
| 60 // in the front of the queue gets a response. | 60 // in the front of the queue gets a response. |
| 61 size_t GetSizeOfQueueForWindow(ServerWindow* window); | 61 size_t GetSizeOfQueueForWindow(ServerWindow* window); |
| 62 | 62 |
| 63 // Sets |current_target_window_| to |current_target|, making sure that we add | 63 // Sets |current_target_window_| to |current_target|, making sure that we add |
| 64 // and release ServerWindow observers correctly. | 64 // and release ServerWindow observers correctly. |
| 65 void SetCurrentTargetWindow(ServerWindow* current_target); | 65 void SetCurrentTargetWindow(ServerWindow* current_target); |
| 66 | 66 |
| 67 // Ensure that |window| has an entry in |window_state_| and that we're an | 67 // Ensure that |window| has an entry in |window_state_| and that we're an |
| 68 // observer. | 68 // observer. |
| 69 void EnsureWindowObserved(ServerWindow* window); | 69 void EnsureWindowObserved(ServerWindow* window); |
| 70 | 70 |
| 71 void QueueOperation(ServerWindow* window, | 71 void QueueOperation(ServerWindow* window, |
| 72 OperationType type, | 72 OperationType type, |
| 73 uint32_t event_flags, | 73 uint32_t event_flags, |
| 74 gfx::Point screen_position); | 74 gfx::Point screen_position); |
| 75 void DispatchOperation(ServerWindow* window, WindowState* state); | 75 void DispatchOperation(ServerWindow* window, WindowState* state); |
| 76 void OnRespondToOperation(ServerWindow* window); | 76 void OnRespondToOperation(ServerWindow* window); |
| 77 | 77 |
| 78 // Callback methods. | 78 // Callback methods. |
| 79 void OnDragStatusCompleted(const WindowId& id, uint32_t bitmask); | 79 void OnDragStatusCompleted(const WindowId& id, uint32_t bitmask); |
| 80 void OnDragDropCompleted(const WindowId& id, uint32_t bitmask); | 80 void OnDragDropCompleted(const WindowId& id, uint32_t action); |
| 81 | 81 |
| 82 // ServerWindowObserver: | 82 // ServerWindowObserver: |
| 83 void OnWindowDestroying(ServerWindow* window) override; | 83 void OnWindowDestroying(ServerWindow* window) override; |
| 84 | 84 |
| 85 // Our owner. | 85 // Our owner. |
| 86 DragSource* source_; | 86 DragSource* source_; |
| 87 | 87 |
| 88 // A bit-field of acceptable drag operations offered by the source. | 88 // A bit-field of acceptable drag operations offered by the source. |
| 89 const uint32_t drag_operations_; | 89 const uint32_t drag_operations_; |
| 90 | 90 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 116 | 116 |
| 117 base::WeakPtrFactory<DragController> weak_factory_; | 117 base::WeakPtrFactory<DragController> weak_factory_; |
| 118 | 118 |
| 119 DISALLOW_COPY_AND_ASSIGN(DragController); | 119 DISALLOW_COPY_AND_ASSIGN(DragController); |
| 120 }; | 120 }; |
| 121 | 121 |
| 122 } // namespace ws | 122 } // namespace ws |
| 123 } // namespace ui | 123 } // namespace ui |
| 124 | 124 |
| 125 #endif // SERVICES_UI_WS_DRAG_CONTROLLER_H_ | 125 #endif // SERVICES_UI_WS_DRAG_CONTROLLER_H_ |
| OLD | NEW |