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

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

Issue 1877043003: [EXPERIMENT] MacViews: Implement Tab Dragging Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: git cl format Created 4 years, 8 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
« no previous file with comments | « ui/views/cocoa/bridged_native_widget.mm ('k') | ui/views/cocoa/cocoa_window_move_loop.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // Added as an kCGEventSourceUserData to the simulated CGEvents that shouldn't
15 // be processed by the BridgedContentViews.
16 extern const int kCocoaWindowMoveLoopSimulatedEventUserData;
17
18 // Used by views::BridgedNativeWidget
19 class CocoaWindowMoveLoop {
20 public:
21 explicit CocoaWindowMoveLoop(BridgedNativeWidget* owner,
22 gfx::Point initial_mouse_in_screen);
23 ~CocoaWindowMoveLoop();
24
25 Widget::MoveLoopResult Run();
26 void End();
27
28 private:
29 enum LoopExitReason {
30 RUNNING,
31 ENDED_EXTERNALLY,
32 ESCAPE_PRESSED,
33 MOUSE_UP,
34 WINDOW_DESTROYED,
35 };
36
37 void OnPositionChanged();
38
39 BridgedNativeWidget* owner_; // Weak. Owns this.
40
41 // Initial mouse location at the time before the CocoaWindowMoveLoop is
42 // created. Cache this as the mouse could be moved when we're inside Run(),
43 // and then sending the MouseDown event will fail.
44 gfx::Point initial_mouse_in_screen_;
45
46 // Pointer to a stack variable holding the exit reason.
47 LoopExitReason* exit_reason_ref_ = nullptr;
48 base::Closure quit_closure_;
49
50 // WeakPtrFactory for event monitor safety.
51 base::WeakPtrFactory<CocoaWindowMoveLoop> weak_factory_;
52
53 DISALLOW_COPY_AND_ASSIGN(CocoaWindowMoveLoop);
54 };
55
56 } // namespace views
57
58 #endif // UI_VIEWS_COCOA_COCOA_WINDOW_MOVE_LOOP_H_
OLDNEW
« no previous file with comments | « ui/views/cocoa/bridged_native_widget.mm ('k') | ui/views/cocoa/cocoa_window_move_loop.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698