| 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 |
| 178 // TODO(jamescook): Should these be AppNSWindow to match apps::AppWindow? |
| 179 // http://crbug.com/344082 |
| 179 @interface ShellNSWindow : ChromeEventProcessingWindow | 180 @interface ShellNSWindow : ChromeEventProcessingWindow |
| 180 @end | 181 @end |
| 181 @implementation ShellNSWindow | 182 @implementation ShellNSWindow |
| 182 @end | 183 @end |
| 183 | 184 |
| 184 @interface ShellCustomFrameNSWindow : ShellNSWindow | 185 @interface ShellCustomFrameNSWindow : ShellNSWindow |
| 185 | 186 |
| 186 - (void)drawCustomFrameRect:(NSRect)rect forView:(NSView*)view; | 187 - (void)drawCustomFrameRect:(NSRect)rect forView:(NSView*)view; |
| 187 | 188 |
| 188 @end | 189 @end |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 appWindow_->HandleMouseEvent(event); | 269 appWindow_->HandleMouseEvent(event); |
| 269 } | 270 } |
| 270 | 271 |
| 271 @end | 272 @end |
| 272 | 273 |
| 273 @interface NSView (WebContentsView) | 274 @interface NSView (WebContentsView) |
| 274 - (void)setMouseDownCanMoveWindow:(BOOL)can_move; | 275 - (void)setMouseDownCanMoveWindow:(BOOL)can_move; |
| 275 @end | 276 @end |
| 276 | 277 |
| 277 NativeAppWindowCocoa::NativeAppWindowCocoa( | 278 NativeAppWindowCocoa::NativeAppWindowCocoa( |
| 278 ShellWindow* shell_window, | 279 AppWindow* app_window, |
| 279 const ShellWindow::CreateParams& params) | 280 const AppWindow::CreateParams& params) |
| 280 : shell_window_(shell_window), | 281 : app_window_(app_window), |
| 281 has_frame_(params.frame == ShellWindow::FRAME_CHROME), | 282 has_frame_(params.frame == AppWindow::FRAME_CHROME), |
| 282 is_hidden_(false), | 283 is_hidden_(false), |
| 283 is_hidden_with_app_(false), | 284 is_hidden_with_app_(false), |
| 284 is_maximized_(false), | 285 is_maximized_(false), |
| 285 is_fullscreen_(false), | 286 is_fullscreen_(false), |
| 286 attention_request_id_(0), | 287 attention_request_id_(0), |
| 287 use_system_drag_(true) { | 288 use_system_drag_(true) { |
| 288 Observe(web_contents()); | 289 Observe(web_contents()); |
| 289 | 290 |
| 290 // Flip coordinates based on the primary screen. | 291 // Flip coordinates based on the primary screen. |
| 291 NSRect main_screen_rect = [[[NSScreen screens] objectAtIndex:0] frame]; | 292 NSRect main_screen_rect = [[[NSScreen screens] objectAtIndex:0] frame]; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 311 if (has_frame_) { | 312 if (has_frame_) { |
| 312 bool should_use_native_frame = | 313 bool should_use_native_frame = |
| 313 CommandLine::ForCurrentProcess()->HasSwitch( | 314 CommandLine::ForCurrentProcess()->HasSwitch( |
| 314 switches::kAppsUseNativeFrame); | 315 switches::kAppsUseNativeFrame); |
| 315 window_class = should_use_native_frame ? | 316 window_class = should_use_native_frame ? |
| 316 [ShellNSWindow class] : [ShellCustomFrameNSWindow class]; | 317 [ShellNSWindow class] : [ShellCustomFrameNSWindow class]; |
| 317 } else { | 318 } else { |
| 318 window_class = [ShellFramelessNSWindow class]; | 319 window_class = [ShellFramelessNSWindow class]; |
| 319 } | 320 } |
| 320 | 321 |
| 321 ShellWindow::SizeConstraints size_constraints = | 322 AppWindow::SizeConstraints size_constraints = app_window_->size_constraints(); |
| 322 shell_window_->size_constraints(); | |
| 323 shows_resize_controls_ = | 323 shows_resize_controls_ = |
| 324 params.resizable && !size_constraints.HasFixedSize(); | 324 params.resizable && !size_constraints.HasFixedSize(); |
| 325 shows_fullscreen_controls_ = | 325 shows_fullscreen_controls_ = |
| 326 params.resizable && !size_constraints.HasMaximumSize(); | 326 params.resizable && !size_constraints.HasMaximumSize(); |
| 327 window.reset([[window_class alloc] | 327 window.reset([[window_class alloc] |
| 328 initWithContentRect:cocoa_bounds | 328 initWithContentRect:cocoa_bounds |
| 329 styleMask:GetWindowStyleMask() | 329 styleMask:GetWindowStyleMask() |
| 330 backing:NSBackingStoreBuffered | 330 backing:NSBackingStoreBuffered |
| 331 defer:NO]); | 331 defer:NO]); |
| 332 [window setTitle:base::SysUTF8ToNSString(extension()->name())]; | 332 [window setTitle:base::SysUTF8ToNSString(extension()->name())]; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 358 system_drag_exclude_areas_.push_back(window_bounds); | 358 system_drag_exclude_areas_.push_back(window_bounds); |
| 359 } | 359 } |
| 360 | 360 |
| 361 InstallView(); | 361 InstallView(); |
| 362 | 362 |
| 363 [[window_controller_ window] setDelegate:window_controller_]; | 363 [[window_controller_ window] setDelegate:window_controller_]; |
| 364 [window_controller_ setAppWindow:this]; | 364 [window_controller_ setAppWindow:this]; |
| 365 UpdateWindowMinMaxSize(); | 365 UpdateWindowMinMaxSize(); |
| 366 | 366 |
| 367 extension_keybinding_registry_.reset(new ExtensionKeybindingRegistryCocoa( | 367 extension_keybinding_registry_.reset(new ExtensionKeybindingRegistryCocoa( |
| 368 Profile::FromBrowserContext(shell_window_->browser_context()), | 368 Profile::FromBrowserContext(app_window_->browser_context()), |
| 369 window, | 369 window, |
| 370 extensions::ExtensionKeybindingRegistry::PLATFORM_APPS_ONLY, | 370 extensions::ExtensionKeybindingRegistry::PLATFORM_APPS_ONLY, |
| 371 shell_window)); | 371 app_window)); |
| 372 } | 372 } |
| 373 | 373 |
| 374 NSUInteger NativeAppWindowCocoa::GetWindowStyleMask() const { | 374 NSUInteger NativeAppWindowCocoa::GetWindowStyleMask() const { |
| 375 NSUInteger style_mask = NSTitledWindowMask | NSClosableWindowMask | | 375 NSUInteger style_mask = NSTitledWindowMask | NSClosableWindowMask | |
| 376 NSMiniaturizableWindowMask; | 376 NSMiniaturizableWindowMask; |
| 377 if (shows_resize_controls_) | 377 if (shows_resize_controls_) |
| 378 style_mask |= NSResizableWindowMask; | 378 style_mask |= NSResizableWindowMask; |
| 379 if (!has_frame_ || | 379 if (!has_frame_ || |
| 380 !CommandLine::ForCurrentProcess()->HasSwitch( | 380 !CommandLine::ForCurrentProcess()->HasSwitch( |
| 381 switches::kAppsUseNativeFrame)) { | 381 switches::kAppsUseNativeFrame)) { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 | 432 |
| 433 bool NativeAppWindowCocoa::IsMinimized() const { | 433 bool NativeAppWindowCocoa::IsMinimized() const { |
| 434 return [window() isMiniaturized]; | 434 return [window() isMiniaturized]; |
| 435 } | 435 } |
| 436 | 436 |
| 437 bool NativeAppWindowCocoa::IsFullscreen() const { | 437 bool NativeAppWindowCocoa::IsFullscreen() const { |
| 438 return is_fullscreen_; | 438 return is_fullscreen_; |
| 439 } | 439 } |
| 440 | 440 |
| 441 void NativeAppWindowCocoa::SetFullscreen(int fullscreen_types) { | 441 void NativeAppWindowCocoa::SetFullscreen(int fullscreen_types) { |
| 442 bool fullscreen = (fullscreen_types != ShellWindow::FULLSCREEN_TYPE_NONE); | 442 bool fullscreen = (fullscreen_types != AppWindow::FULLSCREEN_TYPE_NONE); |
| 443 if (fullscreen == is_fullscreen_) | 443 if (fullscreen == is_fullscreen_) |
| 444 return; | 444 return; |
| 445 is_fullscreen_ = fullscreen; | 445 is_fullscreen_ = fullscreen; |
| 446 | 446 |
| 447 if (base::mac::IsOSLionOrLater()) { | 447 if (base::mac::IsOSLionOrLater()) { |
| 448 // If going fullscreen, but the window is constrained (fullscreen UI control | 448 // If going fullscreen, but the window is constrained (fullscreen UI control |
| 449 // is disabled), temporarily enable it. It will be disabled again on leaving | 449 // is disabled), temporarily enable it. It will be disabled again on leaving |
| 450 // fullscreen. | 450 // fullscreen. |
| 451 if (fullscreen && !shows_fullscreen_controls_) | 451 if (fullscreen && !shows_fullscreen_controls_) |
| 452 SetFullScreenCollectionBehavior(window(), true); | 452 SetFullScreenCollectionBehavior(window(), true); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 return bounds; | 533 return bounds; |
| 534 } | 534 } |
| 535 | 535 |
| 536 void NativeAppWindowCocoa::Show() { | 536 void NativeAppWindowCocoa::Show() { |
| 537 is_hidden_ = false; | 537 is_hidden_ = false; |
| 538 | 538 |
| 539 if (is_hidden_with_app_) { | 539 if (is_hidden_with_app_) { |
| 540 // If there is a shim to gently request attention, return here. Otherwise | 540 // If there is a shim to gently request attention, return here. Otherwise |
| 541 // show the window as usual. | 541 // show the window as usual. |
| 542 if (apps::ExtensionAppShimHandler::RequestUserAttentionForWindow( | 542 if (apps::ExtensionAppShimHandler::RequestUserAttentionForWindow( |
| 543 shell_window_)) { | 543 app_window_)) { |
| 544 return; | 544 return; |
| 545 } | 545 } |
| 546 } | 546 } |
| 547 | 547 |
| 548 [window_controller_ showWindow:nil]; | 548 [window_controller_ showWindow:nil]; |
| 549 Activate(); | 549 Activate(); |
| 550 } | 550 } |
| 551 | 551 |
| 552 void NativeAppWindowCocoa::ShowInactive() { | 552 void NativeAppWindowCocoa::ShowInactive() { |
| 553 is_hidden_ = false; | 553 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 | 620 // setFrame: without animate: does not trigger a windowDidEndLiveResize: so |
| 621 // call it here. | 621 // call it here. |
| 622 WindowDidFinishResize(); | 622 WindowDidFinishResize(); |
| 623 } | 623 } |
| 624 | 624 |
| 625 void NativeAppWindowCocoa::UpdateWindowIcon() { | 625 void NativeAppWindowCocoa::UpdateWindowIcon() { |
| 626 // TODO(junmin): implement. | 626 // TODO(junmin): implement. |
| 627 } | 627 } |
| 628 | 628 |
| 629 void NativeAppWindowCocoa::UpdateWindowTitle() { | 629 void NativeAppWindowCocoa::UpdateWindowTitle() { |
| 630 base::string16 title = shell_window_->GetTitle(); | 630 base::string16 title = app_window_->GetTitle(); |
| 631 [window() setTitle:base::SysUTF16ToNSString(title)]; | 631 [window() setTitle:base::SysUTF16ToNSString(title)]; |
| 632 } | 632 } |
| 633 | 633 |
| 634 void NativeAppWindowCocoa::UpdateBadgeIcon() { | 634 void NativeAppWindowCocoa::UpdateBadgeIcon() { |
| 635 // TODO(benwells): implement. | 635 // TODO(benwells): implement. |
| 636 NOTIMPLEMENTED(); | 636 NOTIMPLEMENTED(); |
| 637 } | 637 } |
| 638 | 638 |
| 639 void NativeAppWindowCocoa::UpdateShape(scoped_ptr<SkRegion> region) { | 639 void NativeAppWindowCocoa::UpdateShape(scoped_ptr<SkRegion> region) { |
| 640 NOTIMPLEMENTED(); | 640 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 | 759 // We still need one ControlRegionView to cover the whole window such that |
| 760 // mouse events could be captured. | 760 // mouse events could be captured. |
| 761 NSView* web_view = web_contents()->GetView()->GetNativeView(); | 761 NSView* web_view = web_contents()->GetView()->GetNativeView(); |
| 762 gfx::Rect window_bounds( | 762 gfx::Rect window_bounds( |
| 763 0, 0, NSWidth([web_view bounds]), NSHeight([web_view bounds])); | 763 0, 0, NSWidth([web_view bounds]), NSHeight([web_view bounds])); |
| 764 system_drag_exclude_areas_.clear(); | 764 system_drag_exclude_areas_.clear(); |
| 765 system_drag_exclude_areas_.push_back(window_bounds); | 765 system_drag_exclude_areas_.push_back(window_bounds); |
| 766 | 766 |
| 767 // Aggregate the draggable areas and non-draggable areas such that hit test | 767 // Aggregate the draggable areas and non-draggable areas such that hit test |
| 768 // could be performed easily. | 768 // could be performed easily. |
| 769 draggable_region_.reset(ShellWindow::RawDraggableRegionsToSkRegion(regions)); | 769 draggable_region_.reset(AppWindow::RawDraggableRegionsToSkRegion(regions)); |
| 770 } | 770 } |
| 771 | 771 |
| 772 void NativeAppWindowCocoa::HandleKeyboardEvent( | 772 void NativeAppWindowCocoa::HandleKeyboardEvent( |
| 773 const content::NativeWebKeyboardEvent& event) { | 773 const content::NativeWebKeyboardEvent& event) { |
| 774 if (event.skip_in_browser || | 774 if (event.skip_in_browser || |
| 775 event.type == content::NativeWebKeyboardEvent::Char) { | 775 event.type == content::NativeWebKeyboardEvent::Char) { |
| 776 return; | 776 return; |
| 777 } | 777 } |
| 778 [window() redispatchKeyEvent:event.os_event]; | 778 [window() redispatchKeyEvent:event.os_event]; |
| 779 } | 779 } |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 874 NOTIMPLEMENTED(); | 874 NOTIMPLEMENTED(); |
| 875 } | 875 } |
| 876 | 876 |
| 877 void NativeAppWindowCocoa::RemoveObserver( | 877 void NativeAppWindowCocoa::RemoveObserver( |
| 878 web_modal::ModalDialogHostObserver* observer) { | 878 web_modal::ModalDialogHostObserver* observer) { |
| 879 NOTIMPLEMENTED(); | 879 NOTIMPLEMENTED(); |
| 880 } | 880 } |
| 881 | 881 |
| 882 void NativeAppWindowCocoa::WindowWillClose() { | 882 void NativeAppWindowCocoa::WindowWillClose() { |
| 883 [window_controller_ setAppWindow:NULL]; | 883 [window_controller_ setAppWindow:NULL]; |
| 884 shell_window_->OnNativeWindowChanged(); | 884 app_window_->OnNativeWindowChanged(); |
| 885 shell_window_->OnNativeClose(); | 885 app_window_->OnNativeClose(); |
| 886 } | 886 } |
| 887 | 887 |
| 888 void NativeAppWindowCocoa::WindowDidBecomeKey() { | 888 void NativeAppWindowCocoa::WindowDidBecomeKey() { |
| 889 content::RenderWidgetHostView* rwhv = | 889 content::RenderWidgetHostView* rwhv = |
| 890 web_contents()->GetRenderWidgetHostView(); | 890 web_contents()->GetRenderWidgetHostView(); |
| 891 if (rwhv) | 891 if (rwhv) |
| 892 rwhv->SetActive(true); | 892 rwhv->SetActive(true); |
| 893 shell_window_->OnNativeWindowActivated(); | 893 app_window_->OnNativeWindowActivated(); |
| 894 | 894 |
| 895 web_contents()->GetView()->RestoreFocus(); | 895 web_contents()->GetView()->RestoreFocus(); |
| 896 } | 896 } |
| 897 | 897 |
| 898 void NativeAppWindowCocoa::WindowDidResignKey() { | 898 void NativeAppWindowCocoa::WindowDidResignKey() { |
| 899 // If our app is still active and we're still the key window, ignore this | 899 // 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") | 900 // 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 | 901 // was activated; we'll get another |-windowDidResignKey| if we ever really |
| 902 // lose key window status. | 902 // lose key window status. |
| 903 if ([NSApp isActive] && ([NSApp keyWindow] == window())) | 903 if ([NSApp isActive] && ([NSApp keyWindow] == window())) |
| (...skipping 23 matching lines...) Expand all Loading... |
| 927 is_fullscreen_ = ([window() styleMask] & NSFullScreenWindowMask) != 0; | 927 is_fullscreen_ = ([window() styleMask] & NSFullScreenWindowMask) != 0; |
| 928 // If not fullscreen but the window is constrained, disable the fullscreen UI | 928 // If not fullscreen but the window is constrained, disable the fullscreen UI |
| 929 // control. | 929 // control. |
| 930 if (!is_fullscreen_ && !shows_fullscreen_controls_) | 930 if (!is_fullscreen_ && !shows_fullscreen_controls_) |
| 931 SetFullScreenCollectionBehavior(window(), false); | 931 SetFullScreenCollectionBehavior(window(), false); |
| 932 | 932 |
| 933 UpdateRestoredBounds(); | 933 UpdateRestoredBounds(); |
| 934 } | 934 } |
| 935 | 935 |
| 936 void NativeAppWindowCocoa::WindowDidResize() { | 936 void NativeAppWindowCocoa::WindowDidResize() { |
| 937 shell_window_->OnNativeWindowChanged(); | 937 app_window_->OnNativeWindowChanged(); |
| 938 } | 938 } |
| 939 | 939 |
| 940 void NativeAppWindowCocoa::WindowDidMove() { | 940 void NativeAppWindowCocoa::WindowDidMove() { |
| 941 UpdateRestoredBounds(); | 941 UpdateRestoredBounds(); |
| 942 shell_window_->OnNativeWindowChanged(); | 942 app_window_->OnNativeWindowChanged(); |
| 943 } | 943 } |
| 944 | 944 |
| 945 void NativeAppWindowCocoa::WindowDidMiniaturize() { | 945 void NativeAppWindowCocoa::WindowDidMiniaturize() { |
| 946 shell_window_->OnNativeWindowChanged(); | 946 app_window_->OnNativeWindowChanged(); |
| 947 } | 947 } |
| 948 | 948 |
| 949 void NativeAppWindowCocoa::WindowDidDeminiaturize() { | 949 void NativeAppWindowCocoa::WindowDidDeminiaturize() { |
| 950 shell_window_->OnNativeWindowChanged(); | 950 app_window_->OnNativeWindowChanged(); |
| 951 } | 951 } |
| 952 | 952 |
| 953 void NativeAppWindowCocoa::WindowWillZoom() { | 953 void NativeAppWindowCocoa::WindowWillZoom() { |
| 954 // See top of file NOTE: Maximize and Zoom. | 954 // See top of file NOTE: Maximize and Zoom. |
| 955 if (IsMaximized()) | 955 if (IsMaximized()) |
| 956 Restore(); | 956 Restore(); |
| 957 else | 957 else |
| 958 Maximize(); | 958 Maximize(); |
| 959 } | 959 } |
| 960 | 960 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1017 CHECK(!window || [window isKindOfClass:[ShellNSWindow class]]); | 1017 CHECK(!window || [window isKindOfClass:[ShellNSWindow class]]); |
| 1018 return static_cast<ShellNSWindow*>(window); | 1018 return static_cast<ShellNSWindow*>(window); |
| 1019 } | 1019 } |
| 1020 | 1020 |
| 1021 void NativeAppWindowCocoa::UpdateRestoredBounds() { | 1021 void NativeAppWindowCocoa::UpdateRestoredBounds() { |
| 1022 if (IsRestored(*this)) | 1022 if (IsRestored(*this)) |
| 1023 restored_bounds_ = [window() frame]; | 1023 restored_bounds_ = [window() frame]; |
| 1024 } | 1024 } |
| 1025 | 1025 |
| 1026 void NativeAppWindowCocoa::UpdateWindowMinMaxSize() { | 1026 void NativeAppWindowCocoa::UpdateWindowMinMaxSize() { |
| 1027 gfx::Size min_size = shell_window_->size_constraints().GetMinimumSize(); | 1027 gfx::Size min_size = app_window_->size_constraints().GetMinimumSize(); |
| 1028 [window() setContentMinSize:NSMakeSize(min_size.width(), min_size.height())]; | 1028 [window() setContentMinSize:NSMakeSize(min_size.width(), min_size.height())]; |
| 1029 | 1029 |
| 1030 gfx::Size max_size = shell_window_->size_constraints().GetMaximumSize(); | 1030 gfx::Size max_size = app_window_->size_constraints().GetMaximumSize(); |
| 1031 const int kUnboundedSize = ShellWindow::SizeConstraints::kUnboundedSize; | 1031 const int kUnboundedSize = AppWindow::SizeConstraints::kUnboundedSize; |
| 1032 CGFloat max_width = max_size.width() == kUnboundedSize ? | 1032 CGFloat max_width = max_size.width() == kUnboundedSize ? |
| 1033 CGFLOAT_MAX : max_size.width(); | 1033 CGFLOAT_MAX : max_size.width(); |
| 1034 CGFloat max_height = max_size.height() == kUnboundedSize ? | 1034 CGFloat max_height = max_size.height() == kUnboundedSize ? |
| 1035 CGFLOAT_MAX : max_size.height(); | 1035 CGFLOAT_MAX : max_size.height(); |
| 1036 [window() setContentMaxSize:NSMakeSize(max_width, max_height)]; | 1036 [window() setContentMaxSize:NSMakeSize(max_width, max_height)]; |
| 1037 } | 1037 } |
| OLD | NEW |