Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(497)

Side by Side Diff: chrome/browser/ui/cocoa/browser_window_controller_private.mm

Issue 10825302: mac: Remove more 10.5-only code (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tweak comments Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #import "chrome/browser/ui/cocoa/browser_window_controller_private.h" 5 #import "chrome/browser/ui/cocoa/browser_window_controller_private.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #import "base/memory/scoped_nsobject.h" 10 #import "base/memory/scoped_nsobject.h"
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 [[bookmarkBarController_ view] setFrame:bookmarkFrame]; 507 [[bookmarkBarController_ view] setFrame:bookmarkFrame];
508 [self layoutSubviews]; 508 [self layoutSubviews];
509 } 509 }
510 510
511 // Fullscreen and presentation mode methods 511 // Fullscreen and presentation mode methods
512 512
513 - (BOOL)shouldShowPresentationModeToggle { 513 - (BOOL)shouldShowPresentationModeToggle {
514 return base::mac::IsOSLionOrLater() && [self isFullscreen]; 514 return base::mac::IsOSLionOrLater() && [self isFullscreen];
515 } 515 }
516 516
517 - (void)moveViewsForFullscreenForSnowLeopardOrEarlier:(BOOL)fullscreen 517 - (void)moveViewsForFullscreenForSnowLeopard:(BOOL)fullscreen
518 regularWindow:(NSWindow*)regularWindow 518 regularWindow:(NSWindow*)regularWindow
519 fullscreenWindow:(NSWindow*)fullscreenWindow { 519 fullscreenWindow:(NSWindow*)fullscreenWindow {
520 // This method is only for Snow Leopard and earlier. 520 // This method is only for Snow Leopard.
521 DCHECK(base::mac::IsOSSnowLeopardOrEarlier()); 521 DCHECK(base::mac::IsOSSnowLeopard());
522 522
523 NSWindow* sourceWindow = fullscreen ? regularWindow : fullscreenWindow; 523 NSWindow* sourceWindow = fullscreen ? regularWindow : fullscreenWindow;
524 NSWindow* destWindow = fullscreen ? fullscreenWindow : regularWindow; 524 NSWindow* destWindow = fullscreen ? fullscreenWindow : regularWindow;
525 525
526 // Close the bookmark bubble, if it's open. Use |-ok:| instead of |-cancel:| 526 // Close the bookmark bubble, if it's open. Use |-ok:| instead of |-cancel:|
527 // or |-close| because that matches the behavior when the bubble loses key 527 // or |-close| because that matches the behavior when the bubble loses key
528 // status. 528 // status.
529 [bookmarkBubbleController_ ok:self]; 529 [bookmarkBubbleController_ ok:self];
530 530
531 // Save the current first responder so we can restore after views are moved. 531 // Save the current first responder so we can restore after views are moved.
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 showDropdown:showDropdown]; 627 showDropdown:showDropdown];
628 } else { 628 } else {
629 [presentationModeController_ exitPresentationMode]; 629 [presentationModeController_ exitPresentationMode];
630 presentationModeController_.reset(); 630 presentationModeController_.reset();
631 } 631 }
632 632
633 [self adjustUIForPresentationMode:presentationMode]; 633 [self adjustUIForPresentationMode:presentationMode];
634 [self layoutSubviews]; 634 [self layoutSubviews];
635 } 635 }
636 636
637 - (void)enterFullscreenForSnowLeopardOrEarlier { 637 - (void)enterFullscreenForSnowLeopard {
638 DCHECK(base::mac::IsOSSnowLeopardOrEarlier()); 638 DCHECK(base::mac::IsOSSnowLeopard());
639 639
640 // Fade to black. 640 // Fade to black.
641 const CGDisplayReservationInterval kFadeDurationSeconds = 0.6; 641 const CGDisplayReservationInterval kFadeDurationSeconds = 0.6;
642 Boolean didFadeOut = NO; 642 Boolean didFadeOut = NO;
643 CGDisplayFadeReservationToken token; 643 CGDisplayFadeReservationToken token;
644 if (CGAcquireDisplayFadeReservation(kFadeDurationSeconds, &token) 644 if (CGAcquireDisplayFadeReservation(kFadeDurationSeconds, &token)
645 == kCGErrorSuccess) { 645 == kCGErrorSuccess) {
646 didFadeOut = YES; 646 didFadeOut = YES;
647 CGDisplayFade(token, kFadeDurationSeconds / 2, kCGDisplayBlendNormal, 647 CGDisplayFade(token, kFadeDurationSeconds / 2, kCGDisplayBlendNormal,
648 kCGDisplayBlendSolidColor, 0.0, 0.0, 0.0, /*synchronous=*/true); 648 kCGDisplayBlendSolidColor, 0.0, 0.0, 0.0, /*synchronous=*/true);
649 } 649 }
650 650
651 // Create the fullscreen window. After this line, isFullscreen will return 651 // Create the fullscreen window. After this line, isFullscreen will return
652 // YES. 652 // YES.
653 fullscreenWindow_.reset([[self createFullscreenWindow] retain]); 653 fullscreenWindow_.reset([[self createFullscreenWindow] retain]);
654 savedRegularWindow_ = [[self window] retain]; 654 savedRegularWindow_ = [[self window] retain];
655 savedRegularWindowFrame_ = [savedRegularWindow_ frame]; 655 savedRegularWindowFrame_ = [savedRegularWindow_ frame];
656 656
657 [self moveViewsForFullscreenForSnowLeopardOrEarlier:YES 657 [self moveViewsForFullscreenForSnowLeopard:YES
658 regularWindow:[self window] 658 regularWindow:[self window]
659 fullscreenWindow:fullscreenWindow_.get()]; 659 fullscreenWindow:fullscreenWindow_.get()];
660 [self adjustUIForPresentationMode:YES]; 660 [self adjustUIForPresentationMode:YES];
661 [self setPresentationModeInternal:YES forceDropdown:NO]; 661 [self setPresentationModeInternal:YES forceDropdown:NO];
662 [self layoutSubviews]; 662 [self layoutSubviews];
663 663
664 [self windowDidEnterFullScreen:nil]; 664 [self windowDidEnterFullScreen:nil];
665 665
666 // Fade back in. 666 // Fade back in.
667 if (didFadeOut) { 667 if (didFadeOut) {
668 CGDisplayFade(token, kFadeDurationSeconds / 2, kCGDisplayBlendSolidColor, 668 CGDisplayFade(token, kFadeDurationSeconds / 2, kCGDisplayBlendSolidColor,
669 kCGDisplayBlendNormal, 0.0, 0.0, 0.0, /*synchronous=*/false); 669 kCGDisplayBlendNormal, 0.0, 0.0, 0.0, /*synchronous=*/false);
670 CGReleaseDisplayFadeReservation(token); 670 CGReleaseDisplayFadeReservation(token);
671 } 671 }
672 } 672 }
673 673
674 - (void)exitFullscreenForSnowLeopardOrEarlier { 674 - (void)exitFullscreenForSnowLeopard {
675 DCHECK(base::mac::IsOSSnowLeopardOrEarlier()); 675 DCHECK(base::mac::IsOSSnowLeopard());
676 676
677 // Fade to black. 677 // Fade to black.
678 const CGDisplayReservationInterval kFadeDurationSeconds = 0.6; 678 const CGDisplayReservationInterval kFadeDurationSeconds = 0.6;
679 Boolean didFadeOut = NO; 679 Boolean didFadeOut = NO;
680 CGDisplayFadeReservationToken token; 680 CGDisplayFadeReservationToken token;
681 if (CGAcquireDisplayFadeReservation(kFadeDurationSeconds, &token) 681 if (CGAcquireDisplayFadeReservation(kFadeDurationSeconds, &token)
682 == kCGErrorSuccess) { 682 == kCGErrorSuccess) {
683 didFadeOut = YES; 683 didFadeOut = YES;
684 CGDisplayFade(token, kFadeDurationSeconds / 2, kCGDisplayBlendNormal, 684 CGDisplayFade(token, kFadeDurationSeconds / 2, kCGDisplayBlendNormal,
685 kCGDisplayBlendSolidColor, 0.0, 0.0, 0.0, /*synchronous=*/true); 685 kCGDisplayBlendSolidColor, 0.0, 0.0, 0.0, /*synchronous=*/true);
686 } 686 }
687 687
688 [self windowWillExitFullScreen:nil]; 688 [self windowWillExitFullScreen:nil];
689 689
690 [self moveViewsForFullscreenForSnowLeopardOrEarlier:NO 690 [self moveViewsForFullscreenForSnowLeopard:NO
691 regularWindow:savedRegularWindow_ 691 regularWindow:savedRegularWindow_
692 fullscreenWindow:fullscreenWindow_.get()]; 692 fullscreenWindow:fullscreenWindow_.get()];
693 693
694 // When exiting fullscreen mode, we need to call layoutSubviews manually. 694 // When exiting fullscreen mode, we need to call layoutSubviews manually.
695 [savedRegularWindow_ autorelease]; 695 [savedRegularWindow_ autorelease];
696 savedRegularWindow_ = nil; 696 savedRegularWindow_ = nil;
697 fullscreenWindow_.reset(); 697 fullscreenWindow_.reset();
698 [self layoutSubviews]; 698 [self layoutSubviews];
699 699
700 [self windowDidExitFullScreen:nil]; 700 [self windowDidExitFullScreen:nil];
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
859 - (void)disableBarVisibilityUpdates { 859 - (void)disableBarVisibilityUpdates {
860 // Early escape if there's nothing to do. 860 // Early escape if there's nothing to do.
861 if (!barVisibilityUpdatesEnabled_) 861 if (!barVisibilityUpdatesEnabled_)
862 return; 862 return;
863 863
864 barVisibilityUpdatesEnabled_ = NO; 864 barVisibilityUpdatesEnabled_ = NO;
865 [presentationModeController_ cancelAnimationAndTimers]; 865 [presentationModeController_ cancelAnimationAndTimers];
866 } 866 }
867 867
868 @end // @implementation BrowserWindowController(Private) 868 @end // @implementation BrowserWindowController(Private)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698