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

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

Issue 1169063002: MacViews: Retain non-Widget parent NSWindows, as well as the anchor NSView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 | « no previous file | 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 #import "ui/views/cocoa/bridged_native_widget_owner.h" 9 #import "ui/views/cocoa/bridged_native_widget_owner.h"
10 10
11 @class NSView; 11 @class NSView;
12 @class NSWindow;
12 @class WidgetOwnerNSWindowAdapterBridge; 13 @class WidgetOwnerNSWindowAdapterBridge;
13 14
14 namespace views { 15 namespace views {
15 16
16 // An adapter that allows a views::Widget to be owned by an NSWindow that is not 17 // An adapter that allows a views::Widget to be owned by an NSWindow that is not
17 // backed by another BridgedNativeWidget. 18 // backed by another BridgedNativeWidget.
18 class WidgetOwnerNSWindowAdapter : public BridgedNativeWidgetOwner { 19 class WidgetOwnerNSWindowAdapter : public BridgedNativeWidgetOwner {
19 public: 20 public:
20 // Create an adapter that will own |child|, tying its lifetime with the 21 // Create an adapter that will own |child|, tying its lifetime with the
21 // NSWindow containing |anchor_view|. The object is self-deleting, via a call 22 // NSWindow containing |anchor_view|. The object is self-deleting, via a call
22 // to RemoveChildWindow() made in child->OnWindowWillClose(). 23 // to RemoveChildWindow() made in child->OnWindowWillClose().
23 WidgetOwnerNSWindowAdapter(BridgedNativeWidget* child, NSView* anchor_view); 24 WidgetOwnerNSWindowAdapter(BridgedNativeWidget* child, NSView* anchor_view);
24 25
25 // Called when the owning window is closing. 26 // Called when the owning window is closing.
26 void OnWindowWillClose(); 27 void OnWindowWillClose();
27 28
28 // Overridden from BridgedNativeWidgetOwner: 29 // Overridden from BridgedNativeWidgetOwner:
29 NSWindow* GetNSWindow() override; 30 NSWindow* GetNSWindow() override;
30 gfx::Vector2d GetChildWindowOffset() const override; 31 gfx::Vector2d GetChildWindowOffset() const override;
31 bool IsVisibleParent() const override; 32 bool IsVisibleParent() const override;
32 void RemoveChildWindow(BridgedNativeWidget* child) override; 33 void RemoveChildWindow(BridgedNativeWidget* child) override;
33 34
34 private: 35 private:
35 // Self-deleting. 36 // Self-deleting.
36 ~WidgetOwnerNSWindowAdapter() override; 37 ~WidgetOwnerNSWindowAdapter() override;
37 38
38 BridgedNativeWidget* child_; // Weak. Owned by its NativeWidgetMac. 39 BridgedNativeWidget* child_; // Weak. Owned by its NativeWidgetMac.
39 base::scoped_nsobject<NSView> anchor_view_; 40 base::scoped_nsobject<NSView> anchor_view_;
41 base::scoped_nsobject<NSWindow> anchor_window_;
40 base::scoped_nsobject<WidgetOwnerNSWindowAdapterBridge> observer_bridge_; 42 base::scoped_nsobject<WidgetOwnerNSWindowAdapterBridge> observer_bridge_;
41 43
42 DISALLOW_COPY_AND_ASSIGN(WidgetOwnerNSWindowAdapter); 44 DISALLOW_COPY_AND_ASSIGN(WidgetOwnerNSWindowAdapter);
43 }; 45 };
44 46
45 } // namespace views 47 } // namespace views
46 48
47 #endif // UI_VIEWS_COCOA_WIDGET_OWNER_NSWINDOW_ADAPTER_H_ 49 #endif // UI_VIEWS_COCOA_WIDGET_OWNER_NSWINDOW_ADAPTER_H_
OLDNEW
« no previous file with comments | « no previous file | ui/views/cocoa/widget_owner_nswindow_adapter.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698