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

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

Issue 1747803003: MacViews: Implement Tab Dragging (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix include. Created 4 years, 6 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/base/test/ui_controls_mac.mm ('k') | ui/views/cocoa/bridged_native_widget.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_VIEWS_COCOA_BRIDGED_NATIVE_WIDGET_H_ 5 #ifndef UI_VIEWS_COCOA_BRIDGED_NATIVE_WIDGET_H_
6 #define UI_VIEWS_COCOA_BRIDGED_NATIVE_WIDGET_H_ 6 #define UI_VIEWS_COCOA_BRIDGED_NATIVE_WIDGET_H_
7 7
8 #import <Cocoa/Cocoa.h> 8 #import <Cocoa/Cocoa.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 16 matching lines...) Expand all
27 namespace ui { 27 namespace ui {
28 class InputMethod; 28 class InputMethod;
29 } 29 }
30 30
31 namespace views { 31 namespace views {
32 namespace test { 32 namespace test {
33 class BridgedNativeWidgetTestApi; 33 class BridgedNativeWidgetTestApi;
34 } 34 }
35 35
36 class CocoaMouseCapture; 36 class CocoaMouseCapture;
37 class CocoaWindowMoveLoop;
37 class DragDropClientMac; 38 class DragDropClientMac;
38 class NativeWidgetMac; 39 class NativeWidgetMac;
39 class View; 40 class View;
40 41
41 // A bridge to an NSWindow managed by an instance of NativeWidgetMac or 42 // A bridge to an NSWindow managed by an instance of NativeWidgetMac or
42 // DesktopNativeWidgetMac. Serves as a helper class to bridge requests from the 43 // DesktopNativeWidgetMac. Serves as a helper class to bridge requests from the
43 // NativeWidgetMac to the Cocoa window. Behaves a bit like an aura::Window. 44 // NativeWidgetMac to the Cocoa window. Behaves a bit like an aura::Window.
44 class VIEWS_EXPORT BridgedNativeWidget 45 class VIEWS_EXPORT BridgedNativeWidget
45 : public ui::LayerDelegate, 46 : public ui::LayerDelegate,
46 public ui::LayerOwner, 47 public ui::LayerOwner,
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 // Sets the desired visibility of the window and updates the visibility of 94 // Sets the desired visibility of the window and updates the visibility of
94 // descendant windows where necessary. 95 // descendant windows where necessary.
95 void SetVisibilityState(WindowVisibilityState new_state); 96 void SetVisibilityState(WindowVisibilityState new_state);
96 97
97 // Acquiring mouse capture first steals capture from any existing 98 // Acquiring mouse capture first steals capture from any existing
98 // CocoaMouseCaptureDelegate, then captures all mouse events until released. 99 // CocoaMouseCaptureDelegate, then captures all mouse events until released.
99 void AcquireCapture(); 100 void AcquireCapture();
100 void ReleaseCapture(); 101 void ReleaseCapture();
101 bool HasCapture(); 102 bool HasCapture();
102 103
104 // Start moving the window, pinned to the mouse cursor, and monitor events.
105 // Return MOVE_LOOP_SUCCESSFUL on mouse up or MOVE_LOOP_CANCELED on premature
106 // termination via EndMoveLoop() or when window is destroyed during the drag.
107 Widget::MoveLoopResult RunMoveLoop(const gfx::Vector2d& drag_offset);
108 void EndMoveLoop();
109
103 // See views::Widget. 110 // See views::Widget.
104 void SetNativeWindowProperty(const char* key, void* value); 111 void SetNativeWindowProperty(const char* key, void* value);
105 void* GetNativeWindowProperty(const char* key) const; 112 void* GetNativeWindowProperty(const char* key) const;
106 113
107 // Sets the cursor associated with the NSWindow. Retains |cursor|. 114 // Sets the cursor associated with the NSWindow. Retains |cursor|.
108 void SetCursor(NSCursor* cursor); 115 void SetCursor(NSCursor* cursor);
109 116
110 // Called internally by the NSWindowDelegate when the window is closing. 117 // Called internally by the NSWindowDelegate when the window is closing.
111 void OnWindowWillClose(); 118 void OnWindowWillClose();
112 119
113 // Called by the NSWindowDelegate when a fullscreen operation begins. If 120 // Called by the NSWindowDelegate when a fullscreen operation begins. If
114 // |target_fullscreen_state| is true, the target state is fullscreen. 121 // |target_fullscreen_state| is true, the target state is fullscreen.
115 // Otherwise, a transition has begun to come out of fullscreen. 122 // Otherwise, a transition has begun to come out of fullscreen.
116 void OnFullscreenTransitionStart(bool target_fullscreen_state); 123 void OnFullscreenTransitionStart(bool target_fullscreen_state);
117 124
118 // Called when a fullscreen transition completes. If target_fullscreen_state() 125 // Called when a fullscreen transition completes. If target_fullscreen_state()
119 // does not match |actual_fullscreen_state|, a new transition will begin. 126 // does not match |actual_fullscreen_state|, a new transition will begin.
120 void OnFullscreenTransitionComplete(bool actual_fullscreen_state); 127 void OnFullscreenTransitionComplete(bool actual_fullscreen_state);
121 128
122 // Transition the window into or out of fullscreen. This will immediately 129 // Transition the window into or out of fullscreen. This will immediately
123 // invert the value of target_fullscreen_state(). 130 // invert the value of target_fullscreen_state().
124 void ToggleDesiredFullscreenState(); 131 void ToggleDesiredFullscreenState();
125 132
126 // Called by the NSWindowDelegate when the size of the window changes. 133 // Called by the NSWindowDelegate when the size of the window changes.
127 void OnSizeChanged(); 134 void OnSizeChanged();
128 135
136 // Called once by the NSWindowDelegate when the position of the window has
137 // changed.
138 void OnPositionChanged();
139
129 // Called by the NSWindowDelegate when the visibility of the window may have 140 // Called by the NSWindowDelegate when the visibility of the window may have
130 // changed. For example, due to a (de)miniaturize operation, or the window 141 // changed. For example, due to a (de)miniaturize operation, or the window
131 // being reordered in (or out of) the screen list. 142 // being reordered in (or out of) the screen list.
132 void OnVisibilityChanged(); 143 void OnVisibilityChanged();
133 144
134 // Explicitly set the visibility. This is called when Cocoa requests a draw, 145 // Explicitly set the visibility. This is called when Cocoa requests a draw,
135 // but hasn't updated the value of -[NSWindow isVisible] yet. 146 // but hasn't updated the value of -[NSWindow isVisible] yet.
136 void OnVisibilityChangedTo(bool new_visibility); 147 void OnVisibilityChangedTo(bool new_visibility);
137 148
138 // Called by the NSWindowDelegate on a scale factor or color space change. 149 // Called by the NSWindowDelegate on a scale factor or color space change.
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 gfx::Vector2d GetChildWindowOffset() const override; 269 gfx::Vector2d GetChildWindowOffset() const override;
259 bool IsVisibleParent() const override; 270 bool IsVisibleParent() const override;
260 void RemoveChildWindow(BridgedNativeWidget* child) override; 271 void RemoveChildWindow(BridgedNativeWidget* child) override;
261 272
262 views::NativeWidgetMac* native_widget_mac_; // Weak. Owns this. 273 views::NativeWidgetMac* native_widget_mac_; // Weak. Owns this.
263 base::scoped_nsobject<NSWindow> window_; 274 base::scoped_nsobject<NSWindow> window_;
264 base::scoped_nsobject<ViewsNSWindowDelegate> window_delegate_; 275 base::scoped_nsobject<ViewsNSWindowDelegate> window_delegate_;
265 base::scoped_nsobject<BridgedContentView> bridged_view_; 276 base::scoped_nsobject<BridgedContentView> bridged_view_;
266 std::unique_ptr<ui::InputMethod> input_method_; 277 std::unique_ptr<ui::InputMethod> input_method_;
267 std::unique_ptr<CocoaMouseCapture> mouse_capture_; 278 std::unique_ptr<CocoaMouseCapture> mouse_capture_;
279 std::unique_ptr<CocoaWindowMoveLoop> window_move_loop_;
268 std::unique_ptr<TooltipManager> tooltip_manager_; 280 std::unique_ptr<TooltipManager> tooltip_manager_;
269 std::unique_ptr<DragDropClientMac> drag_drop_client_; 281 std::unique_ptr<DragDropClientMac> drag_drop_client_;
270 FocusManager* focus_manager_; // Weak. Owned by our Widget. 282 FocusManager* focus_manager_; // Weak. Owned by our Widget.
271 Widget::InitParams::Type widget_type_; 283 Widget::InitParams::Type widget_type_;
272 284
273 BridgedNativeWidgetOwner* parent_; // Weak. If non-null, owns this. 285 BridgedNativeWidgetOwner* parent_; // Weak. If non-null, owns this.
274 std::vector<BridgedNativeWidget*> child_windows_; 286 std::vector<BridgedNativeWidget*> child_windows_;
275 287
276 base::scoped_nsobject<NSView> compositor_superview_; 288 base::scoped_nsobject<NSView> compositor_superview_;
277 std::unique_ptr<ui::AcceleratedWidgetMac> compositor_widget_; 289 std::unique_ptr<ui::AcceleratedWidgetMac> compositor_widget_;
(...skipping 25 matching lines...) Expand all
303 bool invalidate_shadow_on_frame_swap_ = false; 315 bool invalidate_shadow_on_frame_swap_ = false;
304 316
305 AssociatedViews associated_views_; 317 AssociatedViews associated_views_;
306 318
307 DISALLOW_COPY_AND_ASSIGN(BridgedNativeWidget); 319 DISALLOW_COPY_AND_ASSIGN(BridgedNativeWidget);
308 }; 320 };
309 321
310 } // namespace views 322 } // namespace views
311 323
312 #endif // UI_VIEWS_COCOA_BRIDGED_NATIVE_WIDGET_H_ 324 #endif // UI_VIEWS_COCOA_BRIDGED_NATIVE_WIDGET_H_
OLDNEW
« no previous file with comments | « ui/base/test/ui_controls_mac.mm ('k') | ui/views/cocoa/bridged_native_widget.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698