Chromium Code Reviews| Index: ui/views/widget/native_widget_mac.mm |
| diff --git a/ui/views/widget/native_widget_mac.mm b/ui/views/widget/native_widget_mac.mm |
| index 8dc3c40dc1144a08e4f53d4a102cf289137f443f..220507afea0e8624fa90deba9f6d434378443a46 100644 |
| --- a/ui/views/widget/native_widget_mac.mm |
| +++ b/ui/views/widget/native_widget_mac.mm |
| @@ -4,9 +4,12 @@ |
| #include "ui/views/widget/native_widget_mac.h" |
| -#include <Cocoa/Cocoa.h> |
| +#import <Cocoa/Cocoa.h> |
| +#include "base/mac/scoped_nsobject.h" |
| #include "ui/gfx/font_list.h" |
| +#import "ui/views/cocoa/bridged_content_view.h" |
| +#import "ui/views/cocoa/bridged_native_widget.h" |
| namespace views { |
| @@ -14,7 +17,7 @@ namespace views { |
| // NativeWidgetMac, public: |
| NativeWidgetMac::NativeWidgetMac(internal::NativeWidgetDelegate* delegate) |
| - : delegate_(delegate), window_(nil) { |
| + : delegate_(delegate), bridge_(new BridgedNativeWidget) { |
| } |
| NativeWidgetMac::~NativeWidgetMac() { |
| @@ -30,10 +33,12 @@ void NativeWidgetMac::InitNativeWidget(const Widget::InitParams& params) { |
| // TODO(tapted): Determine a good initial style mask from |params|. |
| NSInteger style_mask = NSTitledWindowMask | NSClosableWindowMask | |
| NSMiniaturizableWindowMask | NSResizableWindowMask; |
| - window_.reset([[NSWindow alloc] initWithContentRect:content_rect |
| - styleMask:style_mask |
| - backing:NSBackingStoreBuffered |
| - defer:NO]); |
| + base::scoped_nsobject<NSWindow> window( |
| + [[NSWindow alloc] initWithContentRect:content_rect |
| + styleMask:style_mask |
| + backing:NSBackingStoreBuffered |
| + defer:NO]); |
| + bridge_->Init(window); |
| } |
| NonClientFrameView* NativeWidgetMac::CreateNonClientFrameView() { |
| @@ -62,11 +67,11 @@ const Widget* NativeWidgetMac::GetWidget() const { |
| } |
| gfx::NativeView NativeWidgetMac::GetNativeView() const { |
| - return [window_ contentView]; |
| + return bridge_->ns_view(); |
| } |
| gfx::NativeWindow NativeWidgetMac::GetNativeWindow() const { |
| - return window_; |
| + return bridge_->ns_window(); |
| } |
| Widget* NativeWidgetMac::GetTopLevelWidget() { |
| @@ -90,7 +95,7 @@ ui::Layer* NativeWidgetMac::GetLayer() { |
| } |
| void NativeWidgetMac::ReorderNativeViews() { |
| - NOTIMPLEMENTED(); |
| + bridge_->SetRootView(GetWidget()->GetRootView()); |
| } |
| void NativeWidgetMac::ViewRemoved(View* view) { |
| @@ -182,7 +187,7 @@ void NativeWidgetMac::SetBounds(const gfx::Rect& bounds) { |
| } |
| void NativeWidgetMac::SetSize(const gfx::Size& size) { |
| - [window_ setContentSize:NSMakeSize(size.width(), size.height())]; |
| + [bridge_->ns_window() setContentSize:NSMakeSize(size.width(), size.height())]; |
| } |
| void NativeWidgetMac::StackAbove(gfx::NativeView native_view) { |
| @@ -309,7 +314,7 @@ void NativeWidgetMac::RunShellDrag(View* view, |
| } |
| void NativeWidgetMac::SchedulePaintInRect(const gfx::Rect& rect) { |
| - NOTIMPLEMENTED(); |
| + [bridge_->ns_view() setNeedsDisplay:YES]; |
|
sky
2014/06/11 16:15:53
setNeedsDisplayInRect?
tapted
2014/06/12 09:13:12
Yep - well spotted :) We will definitely want this
|
| } |
| void NativeWidgetMac::SetCursor(gfx::NativeCursor cursor) { |