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

Unified 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: Fix tests and review issues. 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 side-by-side diff with in-line comments
Download patch
Index: ui/views/cocoa/cocoa_window_move_loop.h
diff --git a/ui/views/cocoa/cocoa_window_move_loop.h b/ui/views/cocoa/cocoa_window_move_loop.h
new file mode 100644
index 0000000000000000000000000000000000000000..2524cbf68273ee18147b8233023928d66931558c
--- /dev/null
+++ b/ui/views/cocoa/cocoa_window_move_loop.h
@@ -0,0 +1,56 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_VIEWS_COCOA_COCOA_WINDOW_MOVE_LOOP_H_
+#define UI_VIEWS_COCOA_COCOA_WINDOW_MOVE_LOOP_H_
+
+#include "ui/gfx/geometry/point.h"
+#include "ui/views/widget/widget.h"
+
+namespace views {
+class BridgedNativeWidget;
+
+// Added as an kCGEventSourceUserData to the simulated CGEvents that shouldn't
+// be processed by the BridgedContentViews.
+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.
+
+// 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.
+class CocoaWindowMoveLoop {
+ public:
+ explicit CocoaWindowMoveLoop(BridgedNativeWidget* owner,
tapted 2016/04/13 08:28:12 nit: explicit not needed
themblsha 2016/04/18 09:30:02 Done.
+ gfx::Point initial_mouse_in_screen);
tapted 2016/04/13 08:28:13 nit: const ref
themblsha 2016/04/18 09:30:02 Done.
+ ~CocoaWindowMoveLoop();
+
+ 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.
+ void End();
+
+ private:
+ enum LoopExitReason {
+ ENDED_EXTERNALLY,
+ ESCAPE_PRESSED,
+ MOUSE_UP,
+ WINDOW_DESTROYED,
+ };
+
+ BridgedNativeWidget* owner_; // Weak. Owns this.
+ scoped_ptr<base::RunLoop> run_loop_;
+
+ // Initial mouse location at the time before the CocoaWindowMoveLoop is
+ // 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.
+ // 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.
+ gfx::Point initial_mouse_in_screen_;
+
+ // Pointer to a stack variable holding the exit reason.
+ LoopExitReason* exit_reason_ref_ = nullptr;
+ base::Closure quit_closure_;
+
+ // WeakPtrFactory for event monitor safety.
+ base::WeakPtrFactory<CocoaWindowMoveLoop> weak_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(CocoaWindowMoveLoop);
+};
+
+} // namespace views
+
+#endif // UI_VIEWS_COCOA_COCOA_WINDOW_MOVE_LOOP_H_

Powered by Google App Engine
This is Rietveld 408576698