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

Unified Diff: ui/views/cocoa/bridged_native_widget.h

Issue 309483009: Remaining bits to get views_examples_with_content_exe to work on Mac (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase to master@r275900 Created 6 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 side-by-side diff with in-line comments
Download patch
Index: ui/views/cocoa/bridged_native_widget.h
diff --git a/ui/views/cocoa/bridged_native_widget.h b/ui/views/cocoa/bridged_native_widget.h
new file mode 100644
index 0000000000000000000000000000000000000000..e1eeb8a120b859fd7193f726838df7405c4701cf
--- /dev/null
+++ b/ui/views/cocoa/bridged_native_widget.h
@@ -0,0 +1,45 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_VIEWS_COCOA_BRIDGED_NATIVE_WIDGET_H_
+#define UI_VIEWS_COCOA_BRIDGED_NATIVE_WIDGET_H_
+
+#import <Cocoa/Cocoa.h>
+
+#import "base/mac/scoped_nsobject.h"
+
+@class BridgedContentView;
+
+namespace views {
+
+class View;
+
+// A bridge to an NSWindow managed by an instance of NativeWidgetMac or
+// DesktopNativeWidgetMac. Serves as a helper class to bridge requests from the
+// NativeWidgetMac to the Cocoa window. Behaves a bit like an aura::Window.
+class BridgedNativeWidget {
+ public:
+ BridgedNativeWidget();
+ ~BridgedNativeWidget();
+
+ // Initialize the bridge, "retains" ownership of |window|.
+ void Init(base::scoped_nsobject<NSWindow> window);
+
+ // Set or clears the views::View bridged by the content view. This does NOT
+ // take ownership of |view|.
+ void SetRootView(views::View* view);
+
+ BridgedContentView* ns_view() { return bridged_view_; }
+ NSWindow* ns_window() { return window_; }
+
+ private:
+ base::scoped_nsobject<NSWindow> window_;
+ base::scoped_nsobject<BridgedContentView> bridged_view_;
+
+ DISALLOW_COPY_AND_ASSIGN(BridgedNativeWidget);
+};
+
+} // namespace views
+
+#endif // UI_VIEWS_COCOA_BRIDGED_NATIVE_WIDGET_H_

Powered by Google App Engine
This is Rietveld 408576698