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

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

Issue 2061693003: MacViews: Suppress visibility changes during an asynchronous close. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Neater, but Linux, Windows disagree on WidgetTest.DesktopNativeWidgetVisibilityAfterCloseTest Created 4 years, 4 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 | « no previous file | 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 void SetBounds(const gfx::Rect& new_bounds); 88 void SetBounds(const gfx::Rect& new_bounds);
89 89
90 // Set or clears the views::View bridged by the content view. This does NOT 90 // Set or clears the views::View bridged by the content view. This does NOT
91 // take ownership of |view|. 91 // take ownership of |view|.
92 void SetRootView(views::View* view); 92 void SetRootView(views::View* view);
93 93
94 // 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
95 // descendant windows where necessary. 95 // descendant windows where necessary.
96 void SetVisibilityState(WindowVisibilityState new_state); 96 void SetVisibilityState(WindowVisibilityState new_state);
97 97
98 void CloseAsynchronously();
99
98 // Acquiring mouse capture first steals capture from any existing 100 // Acquiring mouse capture first steals capture from any existing
99 // CocoaMouseCaptureDelegate, then captures all mouse events until released. 101 // CocoaMouseCaptureDelegate, then captures all mouse events until released.
100 void AcquireCapture(); 102 void AcquireCapture();
101 void ReleaseCapture(); 103 void ReleaseCapture();
102 bool HasCapture(); 104 bool HasCapture();
103 105
104 // Start moving the window, pinned to the mouse cursor, and monitor events. 106 // 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 107 // 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. 108 // termination via EndMoveLoop() or when window is destroyed during the drag.
107 Widget::MoveLoopResult RunMoveLoop(const gfx::Vector2d& drag_offset); 109 Widget::MoveLoopResult RunMoveLoop(const gfx::Vector2d& drag_offset);
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 222
221 // Size the layer to match the client area bounds, taking into account display 223 // Size the layer to match the client area bounds, taking into account display
222 // scale factor. 224 // scale factor.
223 void UpdateLayerProperties(); 225 void UpdateLayerProperties();
224 226
225 // Immediately return if there is a composited frame matching |size_in_dip|. 227 // Immediately return if there is a composited frame matching |size_in_dip|.
226 // Otherwise, asks ui::WindowResizeHelperMac to run tasks until a matching 228 // Otherwise, asks ui::WindowResizeHelperMac to run tasks until a matching
227 // frame is ready, or a timeout occurs. 229 // frame is ready, or a timeout occurs.
228 void MaybeWaitForFrame(const gfx::Size& size_in_dip); 230 void MaybeWaitForFrame(const gfx::Size& size_in_dip);
229 231
232 // Return true if the Widget delegate's modal type is window-modal. These
233 // display as a native window "sheet", and have a different lifetime to
234 // regular windows.
235 bool IsWindowModalSheet() const;
236
230 // Show the window using -[NSApp beginSheet:..], modal for the parent window. 237 // Show the window using -[NSApp beginSheet:..], modal for the parent window.
231 void ShowAsModalSheet(); 238 void ShowAsModalSheet();
232 239
233 // Sets mouseDownCanMoveWindow on |bridged_view_| and triggers the NSWindow to 240 // Sets mouseDownCanMoveWindow on |bridged_view_| and triggers the NSWindow to
234 // update its draggable region. 241 // update its draggable region.
235 void SetDraggable(bool draggable); 242 void SetDraggable(bool draggable);
236 243
237 // Overridden from CocoaMouseCaptureDelegate: 244 // Overridden from CocoaMouseCaptureDelegate:
238 void PostCapturedEvent(NSEvent* event) override; 245 void PostCapturedEvent(NSEvent* event) override;
239 void OnMouseCaptureLost() override; 246 void OnMouseCaptureLost() override;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 bool window_visible_; 311 bool window_visible_;
305 312
306 // If true, the window is either visible, or wants to be visible but is 313 // If true, the window is either visible, or wants to be visible but is
307 // currently hidden due to having a hidden parent. 314 // currently hidden due to having a hidden parent.
308 bool wants_to_be_visible_; 315 bool wants_to_be_visible_;
309 316
310 // If true, the window has been made visible or changed shape and the window 317 // If true, the window has been made visible or changed shape and the window
311 // shadow needs to be invalidated when a frame is received for the new shape. 318 // shadow needs to be invalidated when a frame is received for the new shape.
312 bool invalidate_shadow_on_frame_swap_ = false; 319 bool invalidate_shadow_on_frame_swap_ = false;
313 320
321 // Set when an asynchronous close is pending. Visibility changes should be
322 // suppressed in this case. For a synchronous close (e.g. via -[NSWindow
323 // close]), the NSWindowDelegate is just set to nil.
324 bool close_pending_ = false;
325
314 AssociatedViews associated_views_; 326 AssociatedViews associated_views_;
315 327
316 DISALLOW_COPY_AND_ASSIGN(BridgedNativeWidget); 328 DISALLOW_COPY_AND_ASSIGN(BridgedNativeWidget);
317 }; 329 };
318 330
319 } // namespace views 331 } // namespace views
320 332
321 #endif // UI_VIEWS_COCOA_BRIDGED_NATIVE_WIDGET_H_ 333 #endif // UI_VIEWS_COCOA_BRIDGED_NATIVE_WIDGET_H_
OLDNEW
« no previous file with comments | « no previous file | ui/views/cocoa/bridged_native_widget.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698