Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(485)

Side by Side Diff: ui/views/cocoa/cocoa_window_move_loop.h

Issue 1747803003: MacViews: Implement Tab Dragging (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed click simulation, reimplemented CocoaWindowMoveLoop without relying on the WindowServer. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 with a simulated mouse click then monitors window server
22 // events until a mouse up or Escape keypress is observed, or End() is called.
23 Widget::MoveLoopResult Run();
24 void End();
25
26 private:
27 enum LoopExitReason {
28 ENDED_EXTERNALLY,
29 MOUSE_UP,
30 WINDOW_DESTROYED,
31 };
32
33 void OnPositionChanged();
34
35 BridgedNativeWidget* owner_; // Weak. Owns this.
36
37 // Initial mouse location at the time before the CocoaWindowMoveLoop is
38 // created. The first simulated click will happen in this location to
39 // guarantee it reaches the expected NSWindow.
40 gfx::Point initial_mouse_in_screen_;
41
42 // Pointer to a stack variable holding the exit reason.
43 LoopExitReason* exit_reason_ref_ = nullptr;
44 base::Closure quit_closure_;
45
46 // WeakPtrFactory for event monitor safety.
47 base::WeakPtrFactory<CocoaWindowMoveLoop> weak_factory_;
48
49 DISALLOW_COPY_AND_ASSIGN(CocoaWindowMoveLoop);
50 };
51
52 } // namespace views
53
54 #endif // UI_VIEWS_COCOA_COCOA_WINDOW_MOVE_LOOP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698