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" |
11 #include "base/strings/sys_string_conversions.h" | 11 #include "base/strings/sys_string_conversions.h" |
12 #import "ui/base/cocoa/window_size_constants.h" | 12 #import "ui/base/cocoa/window_size_constants.h" |
13 #include "ui/gfx/font_list.h" | 13 #include "ui/gfx/font_list.h" |
14 #import "ui/gfx/mac/coordinate_conversion.h" | 14 #import "ui/gfx/mac/coordinate_conversion.h" |
15 #include "ui/native_theme/native_theme.h" | 15 #include "ui/native_theme/native_theme.h" |
16 #import "ui/views/cocoa/bridged_content_view.h" | 16 #import "ui/views/cocoa/bridged_content_view.h" |
17 #import "ui/views/cocoa/bridged_native_widget.h" | 17 #import "ui/views/cocoa/bridged_native_widget.h" |
18 #import "ui/views/cocoa/native_widget_mac_nswindow.h" | 18 #import "ui/views/cocoa/native_widget_mac_nswindow.h" |
19 #import "ui/views/cocoa/views_nswindow_delegate.h" | 19 #import "ui/views/cocoa/views_nswindow_delegate.h" |
20 #include "ui/views/window/native_frame_view.h" | 20 #include "ui/views/window/native_frame_view.h" |
21 | 21 |
22 namespace views { | 22 namespace views { |
23 namespace { | 23 namespace { |
24 | 24 |
25 // The value used to represent an unbounded width or height. | |
26 const int kUnboundedSize = 0; | |
27 | |
25 NSInteger StyleMaskForParams(const Widget::InitParams& params) { | 28 NSInteger StyleMaskForParams(const Widget::InitParams& params) { |
26 // TODO(tapted): Determine better masks when there are use cases for it. | 29 // TODO(tapted): Determine better masks when there are use cases for it. |
27 if (params.remove_standard_frame) | 30 if (params.remove_standard_frame) |
28 return NSBorderlessWindowMask; | 31 return NSBorderlessWindowMask; |
29 | 32 |
30 if (params.type == Widget::InitParams::TYPE_WINDOW) { | 33 if (params.type == Widget::InitParams::TYPE_WINDOW) { |
31 return NSTitledWindowMask | NSClosableWindowMask | | 34 return NSTitledWindowMask | NSClosableWindowMask | |
32 NSMiniaturizableWindowMask | NSResizableWindowMask; | 35 NSMiniaturizableWindowMask | NSResizableWindowMask; |
33 } | 36 } |
34 return NSBorderlessWindowMask; | 37 return NSBorderlessWindowMask; |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
518 } | 521 } |
519 | 522 |
520 void NativeWidgetMac::OnRootViewLayout() { | 523 void NativeWidgetMac::OnRootViewLayout() { |
521 NOTIMPLEMENTED(); | 524 NOTIMPLEMENTED(); |
522 } | 525 } |
523 | 526 |
524 bool NativeWidgetMac::IsTranslucentWindowOpacitySupported() const { | 527 bool NativeWidgetMac::IsTranslucentWindowOpacitySupported() const { |
525 return false; | 528 return false; |
526 } | 529 } |
527 | 530 |
528 void NativeWidgetMac::OnSizeConstraintsChanged() { | 531 void NativeWidgetMac::OnSizeConstraintsChanged() { |
tapted
2015/03/20 12:12:53
Aura widgets also call this towards the end of Ini
jackhou1
2015/03/25 23:32:23
ChromeNativeAppWindowViews::InitializeDefaultWindo
| |
529 NOTIMPLEMENTED(); | 532 NSWindow* window = GetNativeWindow(); |
533 gfx::Size minimum_size = delegate()->GetMinimumSize(); | |
534 [window setContentMinSize:NSMakeSize(minimum_size.width(), | |
535 minimum_size.height())]; | |
536 | |
537 gfx::Size maximum_size = delegate()->GetMaximumSize(); | |
538 CGFloat max_width = maximum_size.width() == kUnboundedSize | |
539 ? CGFLOAT_MAX | |
540 : maximum_size.width(); | |
541 CGFloat max_height = maximum_size.height() == kUnboundedSize | |
542 ? CGFLOAT_MAX | |
543 : maximum_size.height(); | |
544 [window setContentMaxSize:NSMakeSize(max_width, max_height)]; | |
530 } | 545 } |
531 | 546 |
532 void NativeWidgetMac::RepostNativeEvent(gfx::NativeEvent native_event) { | 547 void NativeWidgetMac::RepostNativeEvent(gfx::NativeEvent native_event) { |
533 NOTIMPLEMENTED(); | 548 NOTIMPLEMENTED(); |
534 } | 549 } |
535 | 550 |
536 //////////////////////////////////////////////////////////////////////////////// | 551 //////////////////////////////////////////////////////////////////////////////// |
537 // NativeWidgetMac, protected: | 552 // NativeWidgetMac, protected: |
538 | 553 |
539 NSWindow* NativeWidgetMac::CreateNSWindow(const Widget::InitParams& params) { | 554 NSWindow* NativeWidgetMac::CreateNSWindow(const Widget::InitParams& params) { |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
640 } | 655 } |
641 | 656 |
642 // static | 657 // static |
643 gfx::FontList NativeWidgetPrivate::GetWindowTitleFontList() { | 658 gfx::FontList NativeWidgetPrivate::GetWindowTitleFontList() { |
644 NOTIMPLEMENTED(); | 659 NOTIMPLEMENTED(); |
645 return gfx::FontList(); | 660 return gfx::FontList(); |
646 } | 661 } |
647 | 662 |
648 } // namespace internal | 663 } // namespace internal |
649 } // namespace views | 664 } // namespace views |
OLD | NEW |