| 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 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 } | 420 } |
| 421 | 421 |
| 422 bool NativeAppWindowCocoa::IsMinimized() const { | 422 bool NativeAppWindowCocoa::IsMinimized() const { |
| 423 return [window() isMiniaturized]; | 423 return [window() isMiniaturized]; |
| 424 } | 424 } |
| 425 | 425 |
| 426 bool NativeAppWindowCocoa::IsFullscreen() const { | 426 bool NativeAppWindowCocoa::IsFullscreen() const { |
| 427 return is_fullscreen_; | 427 return is_fullscreen_; |
| 428 } | 428 } |
| 429 | 429 |
| 430 void NativeAppWindowCocoa::SetFullscreen(bool fullscreen) { | 430 void NativeAppWindowCocoa::SetFullscreen(ShellWindow::FullscreenType type) { |
| 431 bool fullscreen = (type != ShellWindow::FULLSCREEN_TYPE_NONE); |
| 431 if (fullscreen == is_fullscreen_) | 432 if (fullscreen == is_fullscreen_) |
| 432 return; | 433 return; |
| 433 is_fullscreen_ = fullscreen; | 434 is_fullscreen_ = fullscreen; |
| 434 | 435 |
| 435 if (base::mac::IsOSLionOrLater()) { | 436 if (base::mac::IsOSLionOrLater()) { |
| 436 // If going fullscreen, but the window is constrained (fullscreen UI control | 437 // If going fullscreen, but the window is constrained (fullscreen UI control |
| 437 // is disabled), temporarily enable it. It will be disabled again on leaving | 438 // is disabled), temporarily enable it. It will be disabled again on leaving |
| 438 // fullscreen. | 439 // fullscreen. |
| 439 if (fullscreen && !shows_fullscreen_controls_) | 440 if (fullscreen && !shows_fullscreen_controls_) |
| 440 SetFullScreenCollectionBehavior(window(), true); | 441 SetFullScreenCollectionBehavior(window(), true); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 InstallView(); | 477 InstallView(); |
| 477 | 478 |
| 478 // Fade back in. | 479 // Fade back in. |
| 479 if (did_fade_out) { | 480 if (did_fade_out) { |
| 480 CGDisplayFade(token, kFadeDurationSeconds / 2, kCGDisplayBlendSolidColor, | 481 CGDisplayFade(token, kFadeDurationSeconds / 2, kCGDisplayBlendSolidColor, |
| 481 kCGDisplayBlendNormal, 0.0, 0.0, 0.0, /*synchronous=*/false); | 482 kCGDisplayBlendNormal, 0.0, 0.0, 0.0, /*synchronous=*/false); |
| 482 CGReleaseDisplayFadeReservation(token); | 483 CGReleaseDisplayFadeReservation(token); |
| 483 } | 484 } |
| 484 } | 485 } |
| 485 | 486 |
| 486 bool NativeAppWindowCocoa::IsFullscreenOrPending() const { | 487 bool NativeAppWindowCocoa::SupportsImmersiveFullscreen() const { |
| 487 return is_fullscreen_; | 488 return false; |
| 488 } | 489 } |
| 489 | 490 |
| 490 bool NativeAppWindowCocoa::IsDetached() const { | 491 bool NativeAppWindowCocoa::IsDetached() const { |
| 491 return false; | 492 return false; |
| 492 } | 493 } |
| 493 | 494 |
| 494 gfx::NativeWindow NativeAppWindowCocoa::GetNativeWindow() { | 495 gfx::NativeWindow NativeAppWindowCocoa::GetNativeWindow() { |
| 495 return window(); | 496 return window(); |
| 496 } | 497 } |
| 497 | 498 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 UpdateRestoredBounds(); | 565 UpdateRestoredBounds(); |
| 565 is_maximized_ = true; // See top of file NOTE: State Before Update. | 566 is_maximized_ = true; // See top of file NOTE: State Before Update. |
| 566 [window() setFrame:[[window() screen] visibleFrame] display:YES animate:YES]; | 567 [window() setFrame:[[window() screen] visibleFrame] display:YES animate:YES]; |
| 567 } | 568 } |
| 568 | 569 |
| 569 void NativeAppWindowCocoa::Minimize() { | 570 void NativeAppWindowCocoa::Minimize() { |
| 570 [window() miniaturize:window_controller_]; | 571 [window() miniaturize:window_controller_]; |
| 571 } | 572 } |
| 572 | 573 |
| 573 void NativeAppWindowCocoa::Restore() { | 574 void NativeAppWindowCocoa::Restore() { |
| 574 DCHECK(!IsFullscreenOrPending()); // SetFullscreen, not Restore, expected. | 575 DCHECK(!is_fullscreen_); // SetFullscreen, not Restore, expected. |
| 575 | 576 |
| 576 if (IsMaximized()) { | 577 if (IsMaximized()) { |
| 577 is_maximized_ = false; // See top of file NOTE: State Before Update. | 578 is_maximized_ = false; // See top of file NOTE: State Before Update. |
| 578 [window() setFrame:restored_bounds() display:YES animate:YES]; | 579 [window() setFrame:restored_bounds() display:YES animate:YES]; |
| 579 } else if (IsMinimized()) { | 580 } else if (IsMinimized()) { |
| 580 is_maximized_ = false; // See top of file NOTE: State Before Update. | 581 is_maximized_ = false; // See top of file NOTE: State Before Update. |
| 581 [window() deminiaturize:window_controller_]; | 582 [window() deminiaturize:window_controller_]; |
| 582 } | 583 } |
| 583 } | 584 } |
| 584 | 585 |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1009 [window() setContentMinSize:NSMakeSize(min_size.width(), min_size.height())]; | 1010 [window() setContentMinSize:NSMakeSize(min_size.width(), min_size.height())]; |
| 1010 | 1011 |
| 1011 gfx::Size max_size = shell_window_->size_constraints().GetMaximumSize(); | 1012 gfx::Size max_size = shell_window_->size_constraints().GetMaximumSize(); |
| 1012 const int kUnboundedSize = ShellWindow::SizeConstraints::kUnboundedSize; | 1013 const int kUnboundedSize = ShellWindow::SizeConstraints::kUnboundedSize; |
| 1013 CGFloat max_width = max_size.width() == kUnboundedSize ? | 1014 CGFloat max_width = max_size.width() == kUnboundedSize ? |
| 1014 CGFLOAT_MAX : max_size.width(); | 1015 CGFLOAT_MAX : max_size.width(); |
| 1015 CGFloat max_height = max_size.height() == kUnboundedSize ? | 1016 CGFloat max_height = max_size.height() == kUnboundedSize ? |
| 1016 CGFLOAT_MAX : max_size.height(); | 1017 CGFLOAT_MAX : max_size.height(); |
| 1017 [window() setContentMaxSize:NSMakeSize(max_width, max_height)]; | 1018 [window() setContentMaxSize:NSMakeSize(max_width, max_height)]; |
| 1018 } | 1019 } |
| OLD | NEW |