OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 #include "ui/views/widget/native_widget_mac.h" | 5 #include "ui/views/widget/native_widget_mac.h" |
6 | 6 |
7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
8 | 8 |
9 #include "base/mac/foundation_util.h" | 9 #include "base/mac/foundation_util.h" |
10 #include "base/mac/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
78 delegate_->OnNativeWidgetDestroyed(); | 78 delegate_->OnNativeWidgetDestroyed(); |
79 if (ownership_ == Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET) | 79 if (ownership_ == Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET) |
80 delete this; | 80 delete this; |
81 } | 81 } |
82 | 82 |
83 //////////////////////////////////////////////////////////////////////////////// | 83 //////////////////////////////////////////////////////////////////////////////// |
84 // NativeWidgetMac, internal::NativeWidgetPrivate implementation: | 84 // NativeWidgetMac, internal::NativeWidgetPrivate implementation: |
85 | 85 |
86 void NativeWidgetMac::InitNativeWidget(const Widget::InitParams& params) { | 86 void NativeWidgetMac::InitNativeWidget(const Widget::InitParams& params) { |
87 ownership_ = params.ownership; | 87 ownership_ = params.ownership; |
88 | 88 base::scoped_nsobject<NSWindow> window([CreateNSWindow(params) retain]); |
89 NSInteger style_mask = StyleMaskForParams(params); | |
90 base::scoped_nsobject<NSWindow> window([[NativeWidgetMacNSWindow alloc] | |
91 initWithContentRect:ui::kWindowSizeDeterminedLater | |
92 styleMask:style_mask | |
93 backing:NSBackingStoreBuffered | |
94 defer:YES]); | |
95 [window setReleasedWhenClosed:NO]; // Owned by scoped_nsobject. | 89 [window setReleasedWhenClosed:NO]; // Owned by scoped_nsobject. |
96 bridge_->Init(window, params); | 90 bridge_->Init(window, params); |
97 | 91 |
98 delegate_->OnNativeWidgetCreated(true); | 92 delegate_->OnNativeWidgetCreated(true); |
99 | 93 |
100 bridge_->SetFocusManager(GetWidget()->GetFocusManager()); | 94 bridge_->SetFocusManager(GetWidget()->GetFocusManager()); |
101 | 95 |
102 DCHECK(GetWidget()->GetRootView()); | 96 DCHECK(GetWidget()->GetRootView()); |
103 bridge_->SetRootView(GetWidget()->GetRootView()); | 97 bridge_->SetRootView(GetWidget()->GetRootView()); |
104 | 98 |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
516 | 510 |
517 void NativeWidgetMac::OnSizeConstraintsChanged() { | 511 void NativeWidgetMac::OnSizeConstraintsChanged() { |
518 NOTIMPLEMENTED(); | 512 NOTIMPLEMENTED(); |
519 } | 513 } |
520 | 514 |
521 void NativeWidgetMac::RepostNativeEvent(gfx::NativeEvent native_event) { | 515 void NativeWidgetMac::RepostNativeEvent(gfx::NativeEvent native_event) { |
522 NOTIMPLEMENTED(); | 516 NOTIMPLEMENTED(); |
523 } | 517 } |
524 | 518 |
525 //////////////////////////////////////////////////////////////////////////////// | 519 //////////////////////////////////////////////////////////////////////////////// |
520 // NativeWidgetMac, protected: | |
521 | |
522 NSWindow* NativeWidgetMac::CreateNSWindow(const Widget::InitParams& params) { | |
523 return [[NativeWidgetMacNSWindow alloc] | |
524 initWithContentRect:ui::kWindowSizeDeterminedLater | |
525 styleMask:StyleMaskForParams(params) | |
526 backing:NSBackingStoreBuffered | |
527 defer:YES]; | |
tapted
2015/03/18 03:51:58
autorelease
jackhou1
2015/03/18 06:14:17
Done.
| |
528 } | |
529 | |
530 //////////////////////////////////////////////////////////////////////////////// | |
526 // Widget, public: | 531 // Widget, public: |
527 | 532 |
528 bool Widget::ConvertRect(const Widget* source, | 533 bool Widget::ConvertRect(const Widget* source, |
529 const Widget* target, | 534 const Widget* target, |
530 gfx::Rect* rect) { | 535 gfx::Rect* rect) { |
531 return false; | 536 return false; |
532 } | 537 } |
533 | 538 |
534 namespace internal { | 539 namespace internal { |
535 | 540 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
618 } | 623 } |
619 | 624 |
620 // static | 625 // static |
621 gfx::FontList NativeWidgetPrivate::GetWindowTitleFontList() { | 626 gfx::FontList NativeWidgetPrivate::GetWindowTitleFontList() { |
622 NOTIMPLEMENTED(); | 627 NOTIMPLEMENTED(); |
623 return gfx::FontList(); | 628 return gfx::FontList(); |
624 } | 629 } |
625 | 630 |
626 } // namespace internal | 631 } // namespace internal |
627 } // namespace views | 632 } // namespace views |
OLD | NEW |