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

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

Issue 2448243003: MacViews: Reattach children of native windows when they are exposed. (Closed)
Patch Set: respond to comments Created 4 years, 1 month 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.h ('k') | ui/views/cocoa/widget_owner_nswindow_adapter.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_WIDGET_OWNER_NSWINDOW_ADAPTER_H_ 5 #ifndef UI_VIEWS_COCOA_WIDGET_OWNER_NSWINDOW_ADAPTER_H_
6 #define UI_VIEWS_COCOA_WIDGET_OWNER_NSWINDOW_ADAPTER_H_ 6 #define UI_VIEWS_COCOA_WIDGET_OWNER_NSWINDOW_ADAPTER_H_
7 7
8 #import "base/mac/scoped_nsobject.h" 8 #import "base/mac/scoped_nsobject.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #import "ui/views/cocoa/bridged_native_widget_owner.h" 10 #import "ui/views/cocoa/bridged_native_widget_owner.h"
11 11
12 @class NSView; 12 @class NSView;
13 @class NSWindow; 13 @class NSWindow;
14 @class WidgetOwnerNSWindowAdapterBridge; 14 @class WidgetOwnerNSWindowAdapterBridge;
15 15
16 namespace views { 16 namespace views {
17 17
18 // An adapter that allows a views::Widget to be owned by an NSWindow that is not 18 // An adapter that allows a views::Widget to be owned by an NSWindow that is not
19 // backed by another BridgedNativeWidget. 19 // backed by another BridgedNativeWidget.
20 class WidgetOwnerNSWindowAdapter : public BridgedNativeWidgetOwner { 20 class WidgetOwnerNSWindowAdapter : public BridgedNativeWidgetOwner {
21 public: 21 public:
22 // Create an adapter that will own |child|, tying its lifetime with the 22 // Create an adapter that will own |child|, tying its lifetime with the
23 // NSWindow containing |anchor_view|. The object is self-deleting, via a call 23 // NSWindow containing |anchor_view|. The object is self-deleting, via a call
24 // to RemoveChildWindow() made in child->OnWindowWillClose(). 24 // to RemoveChildWindow() made in child->OnWindowWillClose().
25 WidgetOwnerNSWindowAdapter(BridgedNativeWidget* child, NSView* anchor_view); 25 WidgetOwnerNSWindowAdapter(BridgedNativeWidget* child, NSView* anchor_view);
26 26
27 // Called when the owning window is closing. 27 // Called when the owning window is closing.
28 void OnWindowWillClose(); 28 void OnWindowWillClose();
29 29
30 // Called when the owning window is hidden or shown.
31 void OnWindowDidChangeOcclusionState();
32
30 // Overridden from BridgedNativeWidgetOwner: 33 // Overridden from BridgedNativeWidgetOwner:
31 NSWindow* GetNSWindow() override; 34 NSWindow* GetNSWindow() override;
32 gfx::Vector2d GetChildWindowOffset() const override; 35 gfx::Vector2d GetChildWindowOffset() const override;
33 bool IsVisibleParent() const override; 36 bool IsVisibleParent() const override;
34 void RemoveChildWindow(BridgedNativeWidget* child) override; 37 void RemoveChildWindow(BridgedNativeWidget* child) override;
35 38
36 private: 39 private:
37 // Self-deleting. 40 // Self-deleting.
38 ~WidgetOwnerNSWindowAdapter() override; 41 ~WidgetOwnerNSWindowAdapter() override;
39 42
40 BridgedNativeWidget* child_; // Weak. Owned by its NativeWidgetMac. 43 BridgedNativeWidget* child_; // Weak. Owned by its NativeWidgetMac.
41 base::scoped_nsobject<NSView> anchor_view_; 44 base::scoped_nsobject<NSView> anchor_view_;
42 base::scoped_nsobject<NSWindow> anchor_window_; 45 base::scoped_nsobject<NSWindow> anchor_window_;
43 base::scoped_nsobject<WidgetOwnerNSWindowAdapterBridge> observer_bridge_; 46 base::scoped_nsobject<WidgetOwnerNSWindowAdapterBridge> observer_bridge_;
44 47
45 DISALLOW_COPY_AND_ASSIGN(WidgetOwnerNSWindowAdapter); 48 DISALLOW_COPY_AND_ASSIGN(WidgetOwnerNSWindowAdapter);
46 }; 49 };
47 50
48 } // namespace views 51 } // namespace views
49 52
50 #endif // UI_VIEWS_COCOA_WIDGET_OWNER_NSWINDOW_ADAPTER_H_ 53 #endif // UI_VIEWS_COCOA_WIDGET_OWNER_NSWINDOW_ADAPTER_H_
OLDNEW
« no previous file with comments | « ui/views/cocoa/bridged_native_widget.h ('k') | ui/views/cocoa/widget_owner_nswindow_adapter.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698