Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef UI_VIEWS_COCOA_COCOA_WINDOW_MOVE_LOOP_H_ | |
| 6 #define UI_VIEWS_COCOA_COCOA_WINDOW_MOVE_LOOP_H_ | |
| 7 | |
| 8 #include "ui/gfx/geometry/point.h" | |
| 9 #include "ui/views/widget/widget.h" | |
| 10 | |
| 11 namespace views { | |
| 12 class BridgedNativeWidget; | |
| 13 | |
| 14 // Used by views::BridgedNativeWidget when dragging detached tabs. | |
| 15 class CocoaWindowMoveLoop { | |
| 16 public: | |
| 17 CocoaWindowMoveLoop(BridgedNativeWidget* owner, | |
| 18 const gfx::Point& initial_mouse_in_screen); | |
| 19 ~CocoaWindowMoveLoop(); | |
| 20 | |
| 21 // Initiates the drag until a mouse up event is observed, or End() is called. | |
| 22 Widget::MoveLoopResult Run(); | |
| 23 void End(); | |
| 24 | |
| 25 private: | |
| 26 enum LoopExitReason { | |
| 27 ENDED_EXTERNALLY, | |
| 28 MOUSE_UP, | |
| 29 WINDOW_DESTROYED, | |
| 30 }; | |
| 31 | |
| 32 void OnPositionChanged(); | |
| 33 | |
| 34 BridgedNativeWidget* owner_; // Weak. Owns this. | |
| 35 | |
| 36 // Initial mouse location at the time before the CocoaWindowMoveLoop is | |
| 37 // created. | |
| 38 gfx::Point initial_mouse_in_screen_; | |
|
tapted
2016/06/01 11:29:56
NSPoint - see later comments
themblsha
2016/06/03 17:42:08
Done.
| |
| 39 | |
| 40 // Pointer to a stack variable holding the exit reason. | |
| 41 LoopExitReason* exit_reason_ref_ = nullptr; | |
| 42 base::Closure quit_closure_; | |
| 43 | |
| 44 // WeakPtrFactory for event monitor safety. | |
| 45 base::WeakPtrFactory<CocoaWindowMoveLoop> weak_factory_; | |
| 46 | |
| 47 DISALLOW_COPY_AND_ASSIGN(CocoaWindowMoveLoop); | |
| 48 }; | |
| 49 | |
| 50 } // namespace views | |
| 51 | |
| 52 #endif // UI_VIEWS_COCOA_COCOA_WINDOW_MOVE_LOOP_H_ | |
| OLD | NEW |