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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 base::scoped_nsobject<NSWindow> window([CreateNSWindow(params) retain]); | 88 base::scoped_nsobject<NSWindow> window([CreateNSWindow(params) retain]); |
89 [window setReleasedWhenClosed:NO]; // Owned by scoped_nsobject. | 89 [window setReleasedWhenClosed:NO]; // Owned by scoped_nsobject. |
90 bridge_->Init(window, params); | 90 bridge_->Init(window, params); |
91 | 91 |
92 delegate_->OnNativeWidgetCreated(true); | 92 delegate_->OnNativeWidgetCreated(true); |
93 | 93 |
| 94 OnSizeConstraintsChanged(); |
| 95 |
94 bridge_->SetFocusManager(GetWidget()->GetFocusManager()); | 96 bridge_->SetFocusManager(GetWidget()->GetFocusManager()); |
95 | 97 |
96 DCHECK(GetWidget()->GetRootView()); | 98 DCHECK(GetWidget()->GetRootView()); |
97 bridge_->SetRootView(GetWidget()->GetRootView()); | 99 bridge_->SetRootView(GetWidget()->GetRootView()); |
98 | 100 |
99 // "Infer" must be handled by ViewsDelegate::OnBeforeWidgetInit(). | 101 // "Infer" must be handled by ViewsDelegate::OnBeforeWidgetInit(). |
100 DCHECK_NE(Widget::InitParams::INFER_OPACITY, params.opacity); | 102 DCHECK_NE(Widget::InitParams::INFER_OPACITY, params.opacity); |
101 bool translucent = params.opacity == Widget::InitParams::TRANSLUCENT_WINDOW; | 103 bool translucent = params.opacity == Widget::InitParams::TRANSLUCENT_WINDOW; |
102 switch (params.layer_type) { | 104 switch (params.layer_type) { |
103 case aura::WINDOW_LAYER_NONE: | 105 case aura::WINDOW_LAYER_NONE: |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 | 521 |
520 void NativeWidgetMac::OnRootViewLayout() { | 522 void NativeWidgetMac::OnRootViewLayout() { |
521 NOTIMPLEMENTED(); | 523 NOTIMPLEMENTED(); |
522 } | 524 } |
523 | 525 |
524 bool NativeWidgetMac::IsTranslucentWindowOpacitySupported() const { | 526 bool NativeWidgetMac::IsTranslucentWindowOpacitySupported() const { |
525 return false; | 527 return false; |
526 } | 528 } |
527 | 529 |
528 void NativeWidgetMac::OnSizeConstraintsChanged() { | 530 void NativeWidgetMac::OnSizeConstraintsChanged() { |
529 NOTIMPLEMENTED(); | 531 bridge_->OnSizeConstraintsChanged(); |
530 } | 532 } |
531 | 533 |
532 void NativeWidgetMac::RepostNativeEvent(gfx::NativeEvent native_event) { | 534 void NativeWidgetMac::RepostNativeEvent(gfx::NativeEvent native_event) { |
533 NOTIMPLEMENTED(); | 535 NOTIMPLEMENTED(); |
534 } | 536 } |
535 | 537 |
536 //////////////////////////////////////////////////////////////////////////////// | 538 //////////////////////////////////////////////////////////////////////////////// |
537 // NativeWidgetMac, protected: | 539 // NativeWidgetMac, protected: |
538 | 540 |
539 NSWindow* NativeWidgetMac::CreateNSWindow(const Widget::InitParams& params) { | 541 NSWindow* NativeWidgetMac::CreateNSWindow(const Widget::InitParams& params) { |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 } | 642 } |
641 | 643 |
642 // static | 644 // static |
643 gfx::FontList NativeWidgetPrivate::GetWindowTitleFontList() { | 645 gfx::FontList NativeWidgetPrivate::GetWindowTitleFontList() { |
644 NOTIMPLEMENTED(); | 646 NOTIMPLEMENTED(); |
645 return gfx::FontList(); | 647 return gfx::FontList(); |
646 } | 648 } |
647 | 649 |
648 } // namespace internal | 650 } // namespace internal |
649 } // namespace views | 651 } // namespace views |
OLD | NEW |