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 // Added as an kCGEventSourceUserData to the simulated CGEvents that shouldn't | |
| 15 // be processed by the BridgedContentViews. | |
| 16 extern const int kCocoaWindowMoveLoopSimulatedEventUserData; | |
|
tapted
2016/04/13 08:28:13
nit: declare as a static member on CocoaWindowMove
themblsha
2016/04/18 09:30:02
Done.
| |
| 17 | |
| 18 // Used by views::BridgedNativeWidget | |
|
tapted
2016/04/13 08:28:12
This can say more. E.g.
// Used when dragging tab
themblsha
2016/04/18 09:30:02
Done.
| |
| 19 class CocoaWindowMoveLoop { | |
| 20 public: | |
| 21 explicit CocoaWindowMoveLoop(BridgedNativeWidget* owner, | |
|
tapted
2016/04/13 08:28:12
nit: explicit not needed
themblsha
2016/04/18 09:30:02
Done.
| |
| 22 gfx::Point initial_mouse_in_screen); | |
|
tapted
2016/04/13 08:28:13
nit: const ref
themblsha
2016/04/18 09:30:02
Done.
| |
| 23 ~CocoaWindowMoveLoop(); | |
| 24 | |
| 25 Widget::MoveLoopResult Run(); | |
|
tapted
2016/04/13 08:28:13
this looks weird without a comment. Perhaps it's w
themblsha
2016/04/18 09:30:01
Thanks, done.
| |
| 26 void End(); | |
| 27 | |
| 28 private: | |
| 29 enum LoopExitReason { | |
| 30 ENDED_EXTERNALLY, | |
| 31 ESCAPE_PRESSED, | |
| 32 MOUSE_UP, | |
| 33 WINDOW_DESTROYED, | |
| 34 }; | |
| 35 | |
| 36 BridgedNativeWidget* owner_; // Weak. Owns this. | |
| 37 scoped_ptr<base::RunLoop> run_loop_; | |
| 38 | |
| 39 // Initial mouse location at the time before the CocoaWindowMoveLoop is | |
| 40 // created. Cache this as the mouse could be moved when we're inside Run(), | |
|
tapted
2016/04/13 08:28:13
remove "we're"
themblsha
2016/04/18 09:30:02
Done.
| |
| 41 // and then sending the MouseDown event will fail. | |
|
tapted
2016/04/13 08:28:12
say why it will fail?
themblsha
2016/04/18 09:30:01
Done.
| |
| 42 gfx::Point initial_mouse_in_screen_; | |
| 43 | |
| 44 // Pointer to a stack variable holding the exit reason. | |
| 45 LoopExitReason* exit_reason_ref_ = nullptr; | |
| 46 base::Closure quit_closure_; | |
| 47 | |
| 48 // WeakPtrFactory for event monitor safety. | |
| 49 base::WeakPtrFactory<CocoaWindowMoveLoop> weak_factory_; | |
| 50 | |
| 51 DISALLOW_COPY_AND_ASSIGN(CocoaWindowMoveLoop); | |
| 52 }; | |
| 53 | |
| 54 } // namespace views | |
| 55 | |
| 56 #endif // UI_VIEWS_COCOA_COCOA_WINDOW_MOVE_LOOP_H_ | |
| OLD | NEW |