OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef UI_VIEWS_COCOA_BRIDGED_NATIVE_WIDGET_H_ |
| 6 #define UI_VIEWS_COCOA_BRIDGED_NATIVE_WIDGET_H_ |
| 7 |
| 8 #import <Cocoa/Cocoa.h> |
| 9 |
| 10 #import "base/mac/scoped_nsobject.h" |
| 11 |
| 12 @class BridgedContentView; |
| 13 |
| 14 namespace views { |
| 15 |
| 16 class View; |
| 17 |
| 18 // A bridge to an NSWindow managed by an instance of NativeWidgetMac or |
| 19 // DesktopNativeWidgetMac. Serves as a helper class to bridge requests from the |
| 20 // NativeWidgetMac to the Cocoa window. Behaves a bit like an aura::Window. |
| 21 class BridgedNativeWidget { |
| 22 public: |
| 23 BridgedNativeWidget(); |
| 24 ~BridgedNativeWidget(); |
| 25 |
| 26 // Initialize the bridge, "retains" ownership of |window|. |
| 27 void Init(base::scoped_nsobject<NSWindow> window); |
| 28 |
| 29 // Set or clears the views::View bridged by the content view. This does NOT |
| 30 // take ownership of |view|. |
| 31 void SetRootView(views::View* view); |
| 32 |
| 33 BridgedContentView* ns_view() { return bridged_view_; } |
| 34 NSWindow* ns_window() { return window_; } |
| 35 |
| 36 private: |
| 37 base::scoped_nsobject<NSWindow> window_; |
| 38 base::scoped_nsobject<BridgedContentView> bridged_view_; |
| 39 |
| 40 DISALLOW_COPY_AND_ASSIGN(BridgedNativeWidget); |
| 41 }; |
| 42 |
| 43 } // namespace views |
| 44 |
| 45 #endif // UI_VIEWS_COCOA_BRIDGED_NATIVE_WIDGET_H_ |
OLD | NEW |