Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/ui/cocoa/apps/native_app_window_cocoa.h" | 5 #include "chrome/browser/ui/cocoa/apps/native_app_window_cocoa.h" |
| 6 | 6 |
| 7 #include "apps/app_shim/extension_app_shim_handler_mac.h" | 7 #include "apps/app_shim/extension_app_shim_handler_mac.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/mac/mac_util.h" | 9 #include "base/mac/mac_util.h" |
| 10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 31 // | 31 // |
| 32 // Zooming is implemented manually in order to implement maximize functionality | 32 // Zooming is implemented manually in order to implement maximize functionality |
| 33 // and to support non resizable windows. The window will be resized explicitly | 33 // and to support non resizable windows. The window will be resized explicitly |
| 34 // in the |WindowWillZoom| call. | 34 // in the |WindowWillZoom| call. |
| 35 // | 35 // |
| 36 // Attempting maximize and restore functionality with non resizable windows | 36 // Attempting maximize and restore functionality with non resizable windows |
| 37 // using the native zoom method did not work, even with | 37 // using the native zoom method did not work, even with |
| 38 // windowWillUseStandardFrame, as the window would not restore back to the | 38 // windowWillUseStandardFrame, as the window would not restore back to the |
| 39 // desired size. | 39 // desired size. |
| 40 | 40 |
| 41 | 41 using apps::AppWindow; |
| 42 using apps::ShellWindow; | |
| 43 | 42 |
| 44 @interface NSWindow (NSPrivateApis) | 43 @interface NSWindow (NSPrivateApis) |
| 45 - (void)setBottomCornerRounded:(BOOL)rounded; | 44 - (void)setBottomCornerRounded:(BOOL)rounded; |
| 46 @end | 45 @end |
| 47 | 46 |
| 48 // Replicate specific 10.7 SDK declarations for building with prior SDKs. | 47 // Replicate specific 10.7 SDK declarations for building with prior SDKs. |
| 49 #if !defined(MAC_OS_X_VERSION_10_7) || \ | 48 #if !defined(MAC_OS_X_VERSION_10_7) || \ |
| 50 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 | 49 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 |
| 51 | 50 |
| 52 @interface NSWindow (LionSDKDeclarations) | 51 @interface NSWindow (LionSDKDeclarations) |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 169 } | 168 } |
| 170 | 169 |
| 171 @end | 170 @end |
| 172 | 171 |
| 173 // This is really a method on NSGrayFrame, so it should only be called on the | 172 // This is really a method on NSGrayFrame, so it should only be called on the |
| 174 // view passed into -[NSWindow drawCustomFrameRect:forView:]. | 173 // view passed into -[NSWindow drawCustomFrameRect:forView:]. |
| 175 @interface NSView (PrivateMethods) | 174 @interface NSView (PrivateMethods) |
| 176 - (CGFloat)roundedCornerRadius; | 175 - (CGFloat)roundedCornerRadius; |
| 177 @end | 176 @end |
| 178 | 177 |
| 179 @interface ShellNSWindow : ChromeEventProcessingWindow | 178 @interface ShellNSWindow : ChromeEventProcessingWindow |
|
scheib
2014/02/15 00:12:35
Perhaps file an issue to clean up the mac NSWindow
| |
| 180 @end | 179 @end |
| 181 @implementation ShellNSWindow | 180 @implementation ShellNSWindow |
| 182 @end | 181 @end |
| 183 | 182 |
| 184 @interface ShellCustomFrameNSWindow : ShellNSWindow | 183 @interface ShellCustomFrameNSWindow : ShellNSWindow |
| 185 | 184 |
| 186 - (void)drawCustomFrameRect:(NSRect)rect forView:(NSView*)view; | 185 - (void)drawCustomFrameRect:(NSRect)rect forView:(NSView*)view; |
| 187 | 186 |
| 188 @end | 187 @end |
| 189 | 188 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 268 appWindow_->HandleMouseEvent(event); | 267 appWindow_->HandleMouseEvent(event); |
| 269 } | 268 } |
| 270 | 269 |
| 271 @end | 270 @end |
| 272 | 271 |
| 273 @interface NSView (WebContentsView) | 272 @interface NSView (WebContentsView) |
| 274 - (void)setMouseDownCanMoveWindow:(BOOL)can_move; | 273 - (void)setMouseDownCanMoveWindow:(BOOL)can_move; |
| 275 @end | 274 @end |
| 276 | 275 |
| 277 NativeAppWindowCocoa::NativeAppWindowCocoa( | 276 NativeAppWindowCocoa::NativeAppWindowCocoa( |
| 278 ShellWindow* shell_window, | 277 AppWindow* app_window, |
| 279 const ShellWindow::CreateParams& params) | 278 const AppWindow::CreateParams& params) |
| 280 : shell_window_(shell_window), | 279 : app_window_(app_window), |
| 281 has_frame_(params.frame == ShellWindow::FRAME_CHROME), | 280 has_frame_(params.frame == AppWindow::FRAME_CHROME), |
| 282 is_hidden_(false), | 281 is_hidden_(false), |
| 283 is_hidden_with_app_(false), | 282 is_hidden_with_app_(false), |
| 284 is_maximized_(false), | 283 is_maximized_(false), |
| 285 is_fullscreen_(false), | 284 is_fullscreen_(false), |
| 286 attention_request_id_(0), | 285 attention_request_id_(0), |
| 287 use_system_drag_(true) { | 286 use_system_drag_(true) { |
| 288 Observe(web_contents()); | 287 Observe(web_contents()); |
| 289 | 288 |
| 290 // Flip coordinates based on the primary screen. | 289 // Flip coordinates based on the primary screen. |
| 291 NSRect main_screen_rect = [[[NSScreen screens] objectAtIndex:0] frame]; | 290 NSRect main_screen_rect = [[[NSScreen screens] objectAtIndex:0] frame]; |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 311 if (has_frame_) { | 310 if (has_frame_) { |
| 312 bool should_use_native_frame = | 311 bool should_use_native_frame = |
| 313 CommandLine::ForCurrentProcess()->HasSwitch( | 312 CommandLine::ForCurrentProcess()->HasSwitch( |
| 314 switches::kAppsUseNativeFrame); | 313 switches::kAppsUseNativeFrame); |
| 315 window_class = should_use_native_frame ? | 314 window_class = should_use_native_frame ? |
| 316 [ShellNSWindow class] : [ShellCustomFrameNSWindow class]; | 315 [ShellNSWindow class] : [ShellCustomFrameNSWindow class]; |
| 317 } else { | 316 } else { |
| 318 window_class = [ShellFramelessNSWindow class]; | 317 window_class = [ShellFramelessNSWindow class]; |
| 319 } | 318 } |
| 320 | 319 |
| 321 ShellWindow::SizeConstraints size_constraints = | 320 AppWindow::SizeConstraints size_constraints = app_window_->size_constraints(); |
| 322 shell_window_->size_constraints(); | |
| 323 shows_resize_controls_ = | 321 shows_resize_controls_ = |
| 324 params.resizable && !size_constraints.HasFixedSize(); | 322 params.resizable && !size_constraints.HasFixedSize(); |
| 325 shows_fullscreen_controls_ = | 323 shows_fullscreen_controls_ = |
| 326 params.resizable && !size_constraints.HasMaximumSize(); | 324 params.resizable && !size_constraints.HasMaximumSize(); |
| 327 window.reset([[window_class alloc] | 325 window.reset([[window_class alloc] |
| 328 initWithContentRect:cocoa_bounds | 326 initWithContentRect:cocoa_bounds |
| 329 styleMask:GetWindowStyleMask() | 327 styleMask:GetWindowStyleMask() |
| 330 backing:NSBackingStoreBuffered | 328 backing:NSBackingStoreBuffered |
| 331 defer:NO]); | 329 defer:NO]); |
| 332 [window setTitle:base::SysUTF8ToNSString(extension()->name())]; | 330 [window setTitle:base::SysUTF8ToNSString(extension()->name())]; |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 358 system_drag_exclude_areas_.push_back(window_bounds); | 356 system_drag_exclude_areas_.push_back(window_bounds); |
| 359 } | 357 } |
| 360 | 358 |
| 361 InstallView(); | 359 InstallView(); |
| 362 | 360 |
| 363 [[window_controller_ window] setDelegate:window_controller_]; | 361 [[window_controller_ window] setDelegate:window_controller_]; |
| 364 [window_controller_ setAppWindow:this]; | 362 [window_controller_ setAppWindow:this]; |
| 365 UpdateWindowMinMaxSize(); | 363 UpdateWindowMinMaxSize(); |
| 366 | 364 |
| 367 extension_keybinding_registry_.reset(new ExtensionKeybindingRegistryCocoa( | 365 extension_keybinding_registry_.reset(new ExtensionKeybindingRegistryCocoa( |
| 368 Profile::FromBrowserContext(shell_window_->browser_context()), | 366 Profile::FromBrowserContext(app_window_->browser_context()), |
| 369 window, | 367 window, |
| 370 extensions::ExtensionKeybindingRegistry::PLATFORM_APPS_ONLY, | 368 extensions::ExtensionKeybindingRegistry::PLATFORM_APPS_ONLY, |
| 371 shell_window)); | 369 app_window)); |
| 372 } | 370 } |
| 373 | 371 |
| 374 NSUInteger NativeAppWindowCocoa::GetWindowStyleMask() const { | 372 NSUInteger NativeAppWindowCocoa::GetWindowStyleMask() const { |
| 375 NSUInteger style_mask = NSTitledWindowMask | NSClosableWindowMask | | 373 NSUInteger style_mask = NSTitledWindowMask | NSClosableWindowMask | |
| 376 NSMiniaturizableWindowMask; | 374 NSMiniaturizableWindowMask; |
| 377 if (shows_resize_controls_) | 375 if (shows_resize_controls_) |
| 378 style_mask |= NSResizableWindowMask; | 376 style_mask |= NSResizableWindowMask; |
| 379 if (!has_frame_ || | 377 if (!has_frame_ || |
| 380 !CommandLine::ForCurrentProcess()->HasSwitch( | 378 !CommandLine::ForCurrentProcess()->HasSwitch( |
| 381 switches::kAppsUseNativeFrame)) { | 379 switches::kAppsUseNativeFrame)) { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 432 | 430 |
| 433 bool NativeAppWindowCocoa::IsMinimized() const { | 431 bool NativeAppWindowCocoa::IsMinimized() const { |
| 434 return [window() isMiniaturized]; | 432 return [window() isMiniaturized]; |
| 435 } | 433 } |
| 436 | 434 |
| 437 bool NativeAppWindowCocoa::IsFullscreen() const { | 435 bool NativeAppWindowCocoa::IsFullscreen() const { |
| 438 return is_fullscreen_; | 436 return is_fullscreen_; |
| 439 } | 437 } |
| 440 | 438 |
| 441 void NativeAppWindowCocoa::SetFullscreen(int fullscreen_types) { | 439 void NativeAppWindowCocoa::SetFullscreen(int fullscreen_types) { |
| 442 bool fullscreen = (fullscreen_types != ShellWindow::FULLSCREEN_TYPE_NONE); | 440 bool fullscreen = (fullscreen_types != AppWindow::FULLSCREEN_TYPE_NONE); |
| 443 if (fullscreen == is_fullscreen_) | 441 if (fullscreen == is_fullscreen_) |
| 444 return; | 442 return; |
| 445 is_fullscreen_ = fullscreen; | 443 is_fullscreen_ = fullscreen; |
| 446 | 444 |
| 447 if (base::mac::IsOSLionOrLater()) { | 445 if (base::mac::IsOSLionOrLater()) { |
| 448 // If going fullscreen, but the window is constrained (fullscreen UI control | 446 // If going fullscreen, but the window is constrained (fullscreen UI control |
| 449 // is disabled), temporarily enable it. It will be disabled again on leaving | 447 // is disabled), temporarily enable it. It will be disabled again on leaving |
| 450 // fullscreen. | 448 // fullscreen. |
| 451 if (fullscreen && !shows_fullscreen_controls_) | 449 if (fullscreen && !shows_fullscreen_controls_) |
| 452 SetFullScreenCollectionBehavior(window(), true); | 450 SetFullScreenCollectionBehavior(window(), true); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 533 return bounds; | 531 return bounds; |
| 534 } | 532 } |
| 535 | 533 |
| 536 void NativeAppWindowCocoa::Show() { | 534 void NativeAppWindowCocoa::Show() { |
| 537 is_hidden_ = false; | 535 is_hidden_ = false; |
| 538 | 536 |
| 539 if (is_hidden_with_app_) { | 537 if (is_hidden_with_app_) { |
| 540 // If there is a shim to gently request attention, return here. Otherwise | 538 // If there is a shim to gently request attention, return here. Otherwise |
| 541 // show the window as usual. | 539 // show the window as usual. |
| 542 if (apps::ExtensionAppShimHandler::RequestUserAttentionForWindow( | 540 if (apps::ExtensionAppShimHandler::RequestUserAttentionForWindow( |
| 543 shell_window_)) { | 541 app_window_)) { |
| 544 return; | 542 return; |
| 545 } | 543 } |
| 546 } | 544 } |
| 547 | 545 |
| 548 [window_controller_ showWindow:nil]; | 546 [window_controller_ showWindow:nil]; |
| 549 Activate(); | 547 Activate(); |
| 550 } | 548 } |
| 551 | 549 |
| 552 void NativeAppWindowCocoa::ShowInactive() { | 550 void NativeAppWindowCocoa::ShowInactive() { |
| 553 is_hidden_ = false; | 551 is_hidden_ = false; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 620 // setFrame: without animate: does not trigger a windowDidEndLiveResize: so | 618 // setFrame: without animate: does not trigger a windowDidEndLiveResize: so |
| 621 // call it here. | 619 // call it here. |
| 622 WindowDidFinishResize(); | 620 WindowDidFinishResize(); |
| 623 } | 621 } |
| 624 | 622 |
| 625 void NativeAppWindowCocoa::UpdateWindowIcon() { | 623 void NativeAppWindowCocoa::UpdateWindowIcon() { |
| 626 // TODO(junmin): implement. | 624 // TODO(junmin): implement. |
| 627 } | 625 } |
| 628 | 626 |
| 629 void NativeAppWindowCocoa::UpdateWindowTitle() { | 627 void NativeAppWindowCocoa::UpdateWindowTitle() { |
| 630 base::string16 title = shell_window_->GetTitle(); | 628 base::string16 title = app_window_->GetTitle(); |
| 631 [window() setTitle:base::SysUTF16ToNSString(title)]; | 629 [window() setTitle:base::SysUTF16ToNSString(title)]; |
| 632 } | 630 } |
| 633 | 631 |
| 634 void NativeAppWindowCocoa::UpdateBadgeIcon() { | 632 void NativeAppWindowCocoa::UpdateBadgeIcon() { |
| 635 // TODO(benwells): implement. | 633 // TODO(benwells): implement. |
| 636 NOTIMPLEMENTED(); | 634 NOTIMPLEMENTED(); |
| 637 } | 635 } |
| 638 | 636 |
| 639 void NativeAppWindowCocoa::UpdateShape(scoped_ptr<SkRegion> region) { | 637 void NativeAppWindowCocoa::UpdateShape(scoped_ptr<SkRegion> region) { |
| 640 NOTIMPLEMENTED(); | 638 NOTIMPLEMENTED(); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 759 // We still need one ControlRegionView to cover the whole window such that | 757 // We still need one ControlRegionView to cover the whole window such that |
| 760 // mouse events could be captured. | 758 // mouse events could be captured. |
| 761 NSView* web_view = web_contents()->GetView()->GetNativeView(); | 759 NSView* web_view = web_contents()->GetView()->GetNativeView(); |
| 762 gfx::Rect window_bounds( | 760 gfx::Rect window_bounds( |
| 763 0, 0, NSWidth([web_view bounds]), NSHeight([web_view bounds])); | 761 0, 0, NSWidth([web_view bounds]), NSHeight([web_view bounds])); |
| 764 system_drag_exclude_areas_.clear(); | 762 system_drag_exclude_areas_.clear(); |
| 765 system_drag_exclude_areas_.push_back(window_bounds); | 763 system_drag_exclude_areas_.push_back(window_bounds); |
| 766 | 764 |
| 767 // Aggregate the draggable areas and non-draggable areas such that hit test | 765 // Aggregate the draggable areas and non-draggable areas such that hit test |
| 768 // could be performed easily. | 766 // could be performed easily. |
| 769 draggable_region_.reset(ShellWindow::RawDraggableRegionsToSkRegion(regions)); | 767 draggable_region_.reset(AppWindow::RawDraggableRegionsToSkRegion(regions)); |
| 770 } | 768 } |
| 771 | 769 |
| 772 void NativeAppWindowCocoa::HandleKeyboardEvent( | 770 void NativeAppWindowCocoa::HandleKeyboardEvent( |
| 773 const content::NativeWebKeyboardEvent& event) { | 771 const content::NativeWebKeyboardEvent& event) { |
| 774 if (event.skip_in_browser || | 772 if (event.skip_in_browser || |
| 775 event.type == content::NativeWebKeyboardEvent::Char) { | 773 event.type == content::NativeWebKeyboardEvent::Char) { |
| 776 return; | 774 return; |
| 777 } | 775 } |
| 778 [window() redispatchKeyEvent:event.os_event]; | 776 [window() redispatchKeyEvent:event.os_event]; |
| 779 } | 777 } |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 874 NOTIMPLEMENTED(); | 872 NOTIMPLEMENTED(); |
| 875 } | 873 } |
| 876 | 874 |
| 877 void NativeAppWindowCocoa::RemoveObserver( | 875 void NativeAppWindowCocoa::RemoveObserver( |
| 878 web_modal::ModalDialogHostObserver* observer) { | 876 web_modal::ModalDialogHostObserver* observer) { |
| 879 NOTIMPLEMENTED(); | 877 NOTIMPLEMENTED(); |
| 880 } | 878 } |
| 881 | 879 |
| 882 void NativeAppWindowCocoa::WindowWillClose() { | 880 void NativeAppWindowCocoa::WindowWillClose() { |
| 883 [window_controller_ setAppWindow:NULL]; | 881 [window_controller_ setAppWindow:NULL]; |
| 884 shell_window_->OnNativeWindowChanged(); | 882 app_window_->OnNativeWindowChanged(); |
| 885 shell_window_->OnNativeClose(); | 883 app_window_->OnNativeClose(); |
| 886 } | 884 } |
| 887 | 885 |
| 888 void NativeAppWindowCocoa::WindowDidBecomeKey() { | 886 void NativeAppWindowCocoa::WindowDidBecomeKey() { |
| 889 content::RenderWidgetHostView* rwhv = | 887 content::RenderWidgetHostView* rwhv = |
| 890 web_contents()->GetRenderWidgetHostView(); | 888 web_contents()->GetRenderWidgetHostView(); |
| 891 if (rwhv) | 889 if (rwhv) |
| 892 rwhv->SetActive(true); | 890 rwhv->SetActive(true); |
| 893 shell_window_->OnNativeWindowActivated(); | 891 app_window_->OnNativeWindowActivated(); |
| 894 | 892 |
| 895 web_contents()->GetView()->RestoreFocus(); | 893 web_contents()->GetView()->RestoreFocus(); |
| 896 } | 894 } |
| 897 | 895 |
| 898 void NativeAppWindowCocoa::WindowDidResignKey() { | 896 void NativeAppWindowCocoa::WindowDidResignKey() { |
| 899 // If our app is still active and we're still the key window, ignore this | 897 // If our app is still active and we're still the key window, ignore this |
| 900 // message, since it just means that a menu extra (on the "system status bar") | 898 // message, since it just means that a menu extra (on the "system status bar") |
| 901 // was activated; we'll get another |-windowDidResignKey| if we ever really | 899 // was activated; we'll get another |-windowDidResignKey| if we ever really |
| 902 // lose key window status. | 900 // lose key window status. |
| 903 if ([NSApp isActive] && ([NSApp keyWindow] == window())) | 901 if ([NSApp isActive] && ([NSApp keyWindow] == window())) |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 927 is_fullscreen_ = ([window() styleMask] & NSFullScreenWindowMask) != 0; | 925 is_fullscreen_ = ([window() styleMask] & NSFullScreenWindowMask) != 0; |
| 928 // If not fullscreen but the window is constrained, disable the fullscreen UI | 926 // If not fullscreen but the window is constrained, disable the fullscreen UI |
| 929 // control. | 927 // control. |
| 930 if (!is_fullscreen_ && !shows_fullscreen_controls_) | 928 if (!is_fullscreen_ && !shows_fullscreen_controls_) |
| 931 SetFullScreenCollectionBehavior(window(), false); | 929 SetFullScreenCollectionBehavior(window(), false); |
| 932 | 930 |
| 933 UpdateRestoredBounds(); | 931 UpdateRestoredBounds(); |
| 934 } | 932 } |
| 935 | 933 |
| 936 void NativeAppWindowCocoa::WindowDidResize() { | 934 void NativeAppWindowCocoa::WindowDidResize() { |
| 937 shell_window_->OnNativeWindowChanged(); | 935 app_window_->OnNativeWindowChanged(); |
| 938 } | 936 } |
| 939 | 937 |
| 940 void NativeAppWindowCocoa::WindowDidMove() { | 938 void NativeAppWindowCocoa::WindowDidMove() { |
| 941 UpdateRestoredBounds(); | 939 UpdateRestoredBounds(); |
| 942 shell_window_->OnNativeWindowChanged(); | 940 app_window_->OnNativeWindowChanged(); |
| 943 } | 941 } |
| 944 | 942 |
| 945 void NativeAppWindowCocoa::WindowDidMiniaturize() { | 943 void NativeAppWindowCocoa::WindowDidMiniaturize() { |
| 946 shell_window_->OnNativeWindowChanged(); | 944 app_window_->OnNativeWindowChanged(); |
| 947 } | 945 } |
| 948 | 946 |
| 949 void NativeAppWindowCocoa::WindowDidDeminiaturize() { | 947 void NativeAppWindowCocoa::WindowDidDeminiaturize() { |
| 950 shell_window_->OnNativeWindowChanged(); | 948 app_window_->OnNativeWindowChanged(); |
| 951 } | 949 } |
| 952 | 950 |
| 953 void NativeAppWindowCocoa::WindowWillZoom() { | 951 void NativeAppWindowCocoa::WindowWillZoom() { |
| 954 // See top of file NOTE: Maximize and Zoom. | 952 // See top of file NOTE: Maximize and Zoom. |
| 955 if (IsMaximized()) | 953 if (IsMaximized()) |
| 956 Restore(); | 954 Restore(); |
| 957 else | 955 else |
| 958 Maximize(); | 956 Maximize(); |
| 959 } | 957 } |
| 960 | 958 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1017 CHECK(!window || [window isKindOfClass:[ShellNSWindow class]]); | 1015 CHECK(!window || [window isKindOfClass:[ShellNSWindow class]]); |
| 1018 return static_cast<ShellNSWindow*>(window); | 1016 return static_cast<ShellNSWindow*>(window); |
| 1019 } | 1017 } |
| 1020 | 1018 |
| 1021 void NativeAppWindowCocoa::UpdateRestoredBounds() { | 1019 void NativeAppWindowCocoa::UpdateRestoredBounds() { |
| 1022 if (IsRestored(*this)) | 1020 if (IsRestored(*this)) |
| 1023 restored_bounds_ = [window() frame]; | 1021 restored_bounds_ = [window() frame]; |
| 1024 } | 1022 } |
| 1025 | 1023 |
| 1026 void NativeAppWindowCocoa::UpdateWindowMinMaxSize() { | 1024 void NativeAppWindowCocoa::UpdateWindowMinMaxSize() { |
| 1027 gfx::Size min_size = shell_window_->size_constraints().GetMinimumSize(); | 1025 gfx::Size min_size = app_window_->size_constraints().GetMinimumSize(); |
| 1028 [window() setContentMinSize:NSMakeSize(min_size.width(), min_size.height())]; | 1026 [window() setContentMinSize:NSMakeSize(min_size.width(), min_size.height())]; |
| 1029 | 1027 |
| 1030 gfx::Size max_size = shell_window_->size_constraints().GetMaximumSize(); | 1028 gfx::Size max_size = app_window_->size_constraints().GetMaximumSize(); |
| 1031 const int kUnboundedSize = ShellWindow::SizeConstraints::kUnboundedSize; | 1029 const int kUnboundedSize = AppWindow::SizeConstraints::kUnboundedSize; |
| 1032 CGFloat max_width = max_size.width() == kUnboundedSize ? | 1030 CGFloat max_width = max_size.width() == kUnboundedSize ? |
| 1033 CGFLOAT_MAX : max_size.width(); | 1031 CGFLOAT_MAX : max_size.width(); |
| 1034 CGFloat max_height = max_size.height() == kUnboundedSize ? | 1032 CGFloat max_height = max_size.height() == kUnboundedSize ? |
| 1035 CGFLOAT_MAX : max_size.height(); | 1033 CGFLOAT_MAX : max_size.height(); |
| 1036 [window() setContentMaxSize:NSMakeSize(max_width, max_height)]; | 1034 [window() setContentMaxSize:NSMakeSize(max_width, max_height)]; |
| 1037 } | 1035 } |
| OLD | NEW |