Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #include "base/mac/bind_objc_block.h" | 10 #include "base/mac/bind_objc_block.h" |
| 11 #include "base/mac/foundation_util.h" | 11 #include "base/mac/foundation_util.h" |
| 12 #include "base/mac/mac_util.h" | 12 #include "base/mac/mac_util.h" |
| 13 #import "base/mac/scoped_nsobject.h" | 13 #import "base/mac/scoped_nsobject.h" |
| 14 #import "base/mac/sdk_forward_declarations.h" | 14 #import "base/mac/sdk_forward_declarations.h" |
| 15 #include "base/metrics/histogram.h" | 15 #include "base/metrics/histogram.h" |
| 16 #include "base/prefs/pref_service.h" | 16 #include "base/prefs/pref_service.h" |
| 17 #include "base/prefs/scoped_user_pref_update.h" | 17 #include "base/prefs/scoped_user_pref_update.h" |
| 18 #include "chrome/browser/browser_process.h" | 18 #include "chrome/browser/browser_process.h" |
| 19 #include "chrome/browser/fullscreen.h" | 19 #include "chrome/browser/fullscreen.h" |
| 20 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
| 21 #include "chrome/browser/profiles/profile_avatar_icon_util.h" | 21 #include "chrome/browser/profiles/profile_avatar_icon_util.h" |
| 22 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" | 22 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" |
| 23 #include "chrome/browser/ui/browser.h" | 23 #include "chrome/browser/ui/browser.h" |
| 24 #include "chrome/browser/ui/browser_window_state.h" | 24 #include "chrome/browser/ui/browser_window_state.h" |
| 25 #import "chrome/browser/ui/cocoa/browser_window_enter_fullscreen_transition.h" | 25 #import "chrome/browser/ui/cocoa/browser_window_fullscreen_transition.h" |
| 26 #import "chrome/browser/ui/cocoa/browser_window_layout.h" | 26 #import "chrome/browser/ui/cocoa/browser_window_layout.h" |
| 27 #import "chrome/browser/ui/cocoa/custom_frame_view.h" | 27 #import "chrome/browser/ui/cocoa/custom_frame_view.h" |
| 28 #import "chrome/browser/ui/cocoa/dev_tools_controller.h" | 28 #import "chrome/browser/ui/cocoa/dev_tools_controller.h" |
| 29 #import "chrome/browser/ui/cocoa/fast_resize_view.h" | 29 #import "chrome/browser/ui/cocoa/fast_resize_view.h" |
| 30 #import "chrome/browser/ui/cocoa/find_bar/find_bar_cocoa_controller.h" | 30 #import "chrome/browser/ui/cocoa/find_bar/find_bar_cocoa_controller.h" |
| 31 #import "chrome/browser/ui/cocoa/floating_bar_backing_view.h" | 31 #import "chrome/browser/ui/cocoa/floating_bar_backing_view.h" |
| 32 #import "chrome/browser/ui/cocoa/framed_browser_window.h" | 32 #import "chrome/browser/ui/cocoa/framed_browser_window.h" |
| 33 #import "chrome/browser/ui/cocoa/fullscreen_window.h" | 33 #import "chrome/browser/ui/cocoa/fullscreen_window.h" |
| 34 #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h" | 34 #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h" |
| 35 #include "chrome/browser/ui/cocoa/last_active_browser_cocoa.h" | 35 #include "chrome/browser/ui/cocoa/last_active_browser_cocoa.h" |
| 36 #import "chrome/browser/ui/cocoa/presentation_mode_controller.h" | 36 #import "chrome/browser/ui/cocoa/presentation_mode_controller.h" |
| 37 #import "chrome/browser/ui/cocoa/profiles/avatar_button_controller.h" | 37 #import "chrome/browser/ui/cocoa/profiles/avatar_button_controller.h" |
| 38 #import "chrome/browser/ui/cocoa/profiles/avatar_icon_controller.h" | 38 #import "chrome/browser/ui/cocoa/profiles/avatar_icon_controller.h" |
| 39 #import "chrome/browser/ui/cocoa/status_bubble_mac.h" | 39 #import "chrome/browser/ui/cocoa/status_bubble_mac.h" |
| 40 #import "chrome/browser/ui/cocoa/tab_contents/overlayable_contents_controller.h" | 40 #import "chrome/browser/ui/cocoa/tab_contents/overlayable_contents_controller.h" |
| 41 #import "chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.h" | |
| 41 #import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h" | 42 #import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h" |
| 42 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" | 43 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" |
| 43 #import "chrome/browser/ui/cocoa/website_settings/permission_bubble_cocoa.h" | 44 #import "chrome/browser/ui/cocoa/website_settings/permission_bubble_cocoa.h" |
| 44 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" | 45 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" |
| 45 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 46 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 46 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h" | 47 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h" |
| 47 #include "chrome/common/chrome_switches.h" | 48 #include "chrome/common/chrome_switches.h" |
| 48 #include "content/public/browser/render_widget_host_view.h" | 49 #include "content/public/browser/render_widget_host_view.h" |
| 49 #include "content/public/browser/web_contents.h" | 50 #include "content/public/browser/web_contents.h" |
| 50 #import "ui/base/cocoa/focus_tracker.h" | 51 #import "ui/base/cocoa/focus_tracker.h" |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 214 defaultSheetLocation.origin.y = defaultSheetY; | 215 defaultSheetLocation.origin.y = defaultSheetY; |
| 215 return defaultSheetLocation; | 216 return defaultSheetLocation; |
| 216 } | 217 } |
| 217 | 218 |
| 218 - (void)layoutSubviews { | 219 - (void)layoutSubviews { |
| 219 // Suppress title drawing if necessary. | 220 // Suppress title drawing if necessary. |
| 220 if ([self.window respondsToSelector:@selector(setShouldHideTitle:)]) | 221 if ([self.window respondsToSelector:@selector(setShouldHideTitle:)]) |
| 221 [(id)self.window setShouldHideTitle:![self hasTitleBar]]; | 222 [(id)self.window setShouldHideTitle:![self hasTitleBar]]; |
| 222 | 223 |
| 223 [bookmarkBarController_ updateHiddenState]; | 224 [bookmarkBarController_ updateHiddenState]; |
| 225 | |
| 224 [self updateSubviewZOrder]; | 226 [self updateSubviewZOrder]; |
| 225 | 227 |
| 226 base::scoped_nsobject<BrowserWindowLayout> layout( | 228 base::scoped_nsobject<BrowserWindowLayout> layout( |
| 227 [[BrowserWindowLayout alloc] init]); | 229 [[BrowserWindowLayout alloc] init]); |
| 228 [self updateLayoutParameters:layout]; | 230 [self updateLayoutParameters:layout]; |
| 229 [self applyLayout:layout]; | 231 [self applyLayout:layout]; |
| 230 | 232 |
| 231 [toolbarController_ setDividerOpacity:[self toolbarDividerOpacity]]; | 233 [toolbarController_ setDividerOpacity:[self toolbarDividerOpacity]]; |
| 232 | 234 |
| 233 // Will update the location of the permission bubble when showing/hiding the | 235 // Will update the location of the permission bubble when showing/hiding the |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 533 if (CGAcquireDisplayFadeReservation(kFadeDurationSeconds, &token) | 535 if (CGAcquireDisplayFadeReservation(kFadeDurationSeconds, &token) |
| 534 == kCGErrorSuccess) { | 536 == kCGErrorSuccess) { |
| 535 didFadeOut = YES; | 537 didFadeOut = YES; |
| 536 CGDisplayFade(token, kFadeDurationSeconds / 2, kCGDisplayBlendNormal, | 538 CGDisplayFade(token, kFadeDurationSeconds / 2, kCGDisplayBlendNormal, |
| 537 kCGDisplayBlendSolidColor, 0.0, 0.0, 0.0, /*synchronous=*/true); | 539 kCGDisplayBlendSolidColor, 0.0, 0.0, 0.0, /*synchronous=*/true); |
| 538 } | 540 } |
| 539 | 541 |
| 540 // Create the fullscreen window. | 542 // Create the fullscreen window. |
| 541 fullscreenWindow_.reset([[self createFullscreenWindow] retain]); | 543 fullscreenWindow_.reset([[self createFullscreenWindow] retain]); |
| 542 savedRegularWindow_ = [[self window] retain]; | 544 savedRegularWindow_ = [[self window] retain]; |
| 543 savedRegularWindowFrame_ = [savedRegularWindow_ frame]; | |
| 544 | 545 |
| 545 [self moveViewsForImmersiveFullscreen:YES | 546 [self moveViewsForImmersiveFullscreen:YES |
| 546 regularWindow:[self window] | 547 regularWindow:[self window] |
| 547 fullscreenWindow:fullscreenWindow_.get()]; | 548 fullscreenWindow:fullscreenWindow_.get()]; |
| 548 | 549 |
| 549 fullscreen_mac::SlidingStyle style = fullscreen_mac::OMNIBOX_TABS_HIDDEN; | 550 fullscreen_mac::SlidingStyle style = fullscreen_mac::OMNIBOX_TABS_HIDDEN; |
| 550 [self adjustUIForSlidingFullscreenStyle:style]; | 551 [self adjustUIForSlidingFullscreenStyle:style]; |
| 551 | 552 |
| 552 // AppKit is helpful and prevents NSWindows from having the same height as | 553 // AppKit is helpful and prevents NSWindows from having the same height as |
| 553 // the screen while the menu bar is showing. This only applies to windows on | 554 // the screen while the menu bar is showing. This only applies to windows on |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 681 } | 682 } |
| 682 | 683 |
| 683 - (void)windowWillEnterFullScreen:(NSNotification*)notification { | 684 - (void)windowWillEnterFullScreen:(NSNotification*)notification { |
| 684 RecordFullscreenWindowLocation([self window]); | 685 RecordFullscreenWindowLocation([self window]); |
| 685 RecordFullscreenStyle(enteringPresentationMode_ ? PRESENTATION_MODE | 686 RecordFullscreenStyle(enteringPresentationMode_ ? PRESENTATION_MODE |
| 686 : CANONICAL_FULLSCREEN); | 687 : CANONICAL_FULLSCREEN); |
| 687 | 688 |
| 688 if (notification) // For System Fullscreen when non-nil. | 689 if (notification) // For System Fullscreen when non-nil. |
| 689 [self registerForContentViewResizeNotifications]; | 690 [self registerForContentViewResizeNotifications]; |
| 690 | 691 |
| 691 NSWindow* window = [self window]; | |
| 692 savedRegularWindowFrame_ = [window frame]; | |
| 693 BOOL mode = enteringPresentationMode_ || | 692 BOOL mode = enteringPresentationMode_ || |
| 694 browser_->exclusive_access_manager() | 693 browser_->exclusive_access_manager() |
| 695 ->fullscreen_controller() | 694 ->fullscreen_controller() |
| 696 ->IsWindowFullscreenForTabOrPending(); | 695 ->IsWindowFullscreenForTabOrPending(); |
| 697 enteringAppKitFullscreen_ = YES; | 696 enteringAppKitFullscreen_ = YES; |
| 698 enteringAppKitFullscreenOnPrimaryScreen_ = | 697 enteringAppKitFullscreenOnPrimaryScreen_ = |
| 699 [[[self window] screen] isEqual:[[NSScreen screens] objectAtIndex:0]]; | 698 [[[self window] screen] isEqual:[[NSScreen screens] objectAtIndex:0]]; |
| 700 | 699 |
| 701 fullscreen_mac::SlidingStyle style = | 700 fullscreen_mac::SlidingStyle style = |
| 702 mode ? fullscreen_mac::OMNIBOX_TABS_HIDDEN | 701 mode ? fullscreen_mac::OMNIBOX_TABS_HIDDEN |
| 703 : fullscreen_mac::OMNIBOX_TABS_PRESENT; | 702 : fullscreen_mac::OMNIBOX_TABS_PRESENT; |
| 704 | 703 |
| 705 [self adjustUIForSlidingFullscreenStyle:style]; | 704 [self adjustUIForSlidingFullscreenStyle:style]; |
| 706 } | 705 } |
| 707 | 706 |
| 708 - (void)windowDidEnterFullScreen:(NSNotification*)notification { | 707 - (void)windowDidEnterFullScreen:(NSNotification*)notification { |
| 709 enterFullscreenTransition_.reset(); | |
| 710 | |
| 711 // In Yosemite, some combination of the titlebar and toolbar always show in | 708 // In Yosemite, some combination of the titlebar and toolbar always show in |
| 712 // full-screen mode. We do not want either to show. Search for the window that | 709 // full-screen mode. We do not want either to show. Search for the window that |
| 713 // contains the views, and hide it. There is no need to ever unhide the view. | 710 // contains the views, and hide it. There is no need to ever unhide the view. |
| 714 // http://crbug.com/380235 | 711 // http://crbug.com/380235 |
| 715 if (base::mac::IsOSYosemiteOrLater()) { | 712 if (base::mac::IsOSYosemiteOrLater()) { |
| 716 for (NSWindow* window in [[NSApplication sharedApplication] windows]) { | 713 for (NSWindow* window in [[NSApplication sharedApplication] windows]) { |
| 717 if ([window | 714 if ([window |
| 718 isKindOfClass:NSClassFromString(@"NSToolbarFullScreenWindow")]) { | 715 isKindOfClass:NSClassFromString(@"NSToolbarFullScreenWindow")]) { |
| 719 [[window contentView] setHidden:YES]; | 716 [[window contentView] setHidden:YES]; |
| 720 } | 717 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 754 enteringPresentationMode_ = NO; | 751 enteringPresentationMode_ = NO; |
| 755 | 752 |
| 756 [self showFullscreenExitBubbleIfNecessary]; | 753 [self showFullscreenExitBubbleIfNecessary]; |
| 757 browser_->WindowFullscreenStateChanged(); | 754 browser_->WindowFullscreenStateChanged(); |
| 758 [[[self window] contentView] setWantsLayer:windowViewWantsLayer_]; | 755 [[[self window] contentView] setWantsLayer:windowViewWantsLayer_]; |
| 759 } | 756 } |
| 760 | 757 |
| 761 - (void)windowWillExitFullScreen:(NSNotification*)notification { | 758 - (void)windowWillExitFullScreen:(NSNotification*)notification { |
| 762 if (notification) // For System Fullscreen when non-nil. | 759 if (notification) // For System Fullscreen when non-nil. |
| 763 [self registerForContentViewResizeNotifications]; | 760 [self registerForContentViewResizeNotifications]; |
| 761 exitingAppKitFullscreen_ = YES; | |
| 762 | |
| 764 [self destroyFullscreenExitBubbleIfNecessary]; | 763 [self destroyFullscreenExitBubbleIfNecessary]; |
| 765 [self adjustUIForExitingFullscreenAndStopOmniboxSliding]; | 764 [self adjustUIForExitingFullscreenAndStopOmniboxSliding]; |
| 766 } | 765 } |
| 767 | 766 |
| 768 - (void)windowDidExitFullScreen:(NSNotification*)notification { | 767 - (void)windowDidExitFullScreen:(NSNotification*)notification { |
| 768 fullscreenTransition_.reset(); | |
| 769 if (notification) // For System Fullscreen when non-nil. | 769 if (notification) // For System Fullscreen when non-nil. |
| 770 [self deregisterForContentViewResizeNotifications]; | 770 [self deregisterForContentViewResizeNotifications]; |
| 771 | |
| 772 FramedBrowserWindow* framedWindow = (FramedBrowserWindow*)[self window]; | |
| 773 [framedWindow setFrameAndStyleLock:NO]; | |
| 774 | |
| 775 if (exitingAppKitFullscreen_) { | |
| 776 [self layoutSubviews]; | |
| 777 } | |
| 778 exitingAppKitFullscreen_ = NO; | |
| 779 | |
| 771 browser_->WindowFullscreenStateChanged(); | 780 browser_->WindowFullscreenStateChanged(); |
| 772 } | 781 } |
| 773 | 782 |
| 774 - (void)windowDidFailToEnterFullScreen:(NSWindow*)window { | 783 - (void)windowDidFailToEnterFullScreen:(NSWindow*)window { |
| 775 [self deregisterForContentViewResizeNotifications]; | 784 [self deregisterForContentViewResizeNotifications]; |
| 776 enteringAppKitFullscreen_ = NO; | 785 enteringAppKitFullscreen_ = NO; |
| 786 FramedBrowserWindow* framedWindow = (FramedBrowserWindow*)[self window]; | |
| 787 [framedWindow setFrameAndStyleLock:NO]; | |
|
spqchan1
2015/08/12 19:34:41
Removed the lock here because reset() should get r
| |
| 777 [self adjustUIForExitingFullscreenAndStopOmniboxSliding]; | 788 [self adjustUIForExitingFullscreenAndStopOmniboxSliding]; |
| 789 | |
| 778 } | 790 } |
| 779 | 791 |
| 780 - (void)windowDidFailToExitFullScreen:(NSWindow*)window { | 792 - (void)windowDidFailToExitFullScreen:(NSWindow*)window { |
| 781 [self deregisterForContentViewResizeNotifications]; | 793 [self deregisterForContentViewResizeNotifications]; |
| 782 | 794 exitingAppKitFullscreen_ = NO; |
| 783 // Force a relayout to try and get the window back into a reasonable state. | 795 // Force a relayout to try and get the window back into a reasonable state. |
| 784 [self layoutSubviews]; | 796 [self layoutSubviews]; |
| 785 } | 797 } |
| 786 | 798 |
| 787 - (void)enableBarVisibilityUpdates { | 799 - (void)enableBarVisibilityUpdates { |
| 788 // Early escape if there's nothing to do. | 800 // Early escape if there's nothing to do. |
| 789 if (barVisibilityUpdatesEnabled_) | 801 if (barVisibilityUpdatesEnabled_) |
| 790 return; | 802 return; |
| 791 | 803 |
| 792 barVisibilityUpdatesEnabled_ = YES; | 804 barVisibilityUpdatesEnabled_ = YES; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 869 // We need to return where the button should be positioned. | 881 // We need to return where the button should be positioned. |
| 870 NSView* rootView = [[[self window] contentView] superview]; | 882 NSView* rootView = [[[self window] contentView] superview]; |
| 871 if ([rootView respondsToSelector:@selector(_fullScreenButtonOrigin)]) | 883 if ([rootView respondsToSelector:@selector(_fullScreenButtonOrigin)]) |
| 872 buttonFrame.origin = [rootView _fullScreenButtonOrigin]; | 884 buttonFrame.origin = [rootView _fullScreenButtonOrigin]; |
| 873 | 885 |
| 874 return buttonFrame; | 886 return buttonFrame; |
| 875 } | 887 } |
| 876 | 888 |
| 877 - (void)updateLayoutParameters:(BrowserWindowLayout*)layout { | 889 - (void)updateLayoutParameters:(BrowserWindowLayout*)layout { |
| 878 [layout setContentViewSize:[[[self window] contentView] bounds].size]; | 890 [layout setContentViewSize:[[[self window] contentView] bounds].size]; |
| 879 [layout setWindowSize:[[self window] frame].size]; | 891 |
| 892 NSSize windowSize = (exitingAppKitFullscreen_) ? | |
| 893 [[[self window] contentView] bounds].size : [[self window] frame].size; | |
| 894 [layout setWindowSize:windowSize]; | |
| 880 | 895 |
| 881 [layout setInAnyFullscreen:[self isInAnyFullscreenMode]]; | 896 [layout setInAnyFullscreen:[self isInAnyFullscreenMode]]; |
| 882 [layout setFullscreenSlidingStyle: | 897 [layout setFullscreenSlidingStyle: |
| 883 presentationModeController_.get().slidingStyle]; | 898 presentationModeController_.get().slidingStyle]; |
| 884 [layout setFullscreenMenubarOffset: | 899 [layout setFullscreenMenubarOffset: |
| 885 [presentationModeController_ menubarOffset]]; | 900 [presentationModeController_ menubarOffset]]; |
| 886 [layout setFullscreenToolbarFraction: | 901 [layout setFullscreenToolbarFraction: |
| 887 [presentationModeController_ toolbarFraction]]; | 902 [presentationModeController_ toolbarFraction]]; |
| 888 | 903 |
| 889 [layout setHasTabStrip:[self hasTabStrip]]; | 904 [layout setHasTabStrip:[self hasTabStrip]]; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 956 [findBarCocoaController_ | 971 [findBarCocoaController_ |
| 957 positionFindBarViewAtMaxY:output.findBarMaxY | 972 positionFindBarViewAtMaxY:output.findBarMaxY |
| 958 maxWidth:NSWidth(output.contentAreaFrame)]; | 973 maxWidth:NSWidth(output.contentAreaFrame)]; |
| 959 | 974 |
| 960 [exclusiveAccessBubbleWindowController_ | 975 [exclusiveAccessBubbleWindowController_ |
| 961 positionInWindowAtTop:output.fullscreenExitButtonMaxY | 976 positionInWindowAtTop:output.fullscreenExitButtonMaxY |
| 962 width:NSWidth(output.contentAreaFrame)]; | 977 width:NSWidth(output.contentAreaFrame)]; |
| 963 } | 978 } |
| 964 | 979 |
| 965 - (void)updateSubviewZOrder { | 980 - (void)updateSubviewZOrder { |
| 966 if ([self isInAnyFullscreenMode]) | 981 if ([self isInAnyFullscreenMode]) { |
| 967 [self updateSubviewZOrderFullscreen]; | 982 [self updateSubviewZOrderFullscreen]; |
| 968 else | 983 } else { |
| 969 [self updateSubviewZOrderNormal]; | 984 [self updateSubviewZOrderNormal]; |
| 985 } | |
| 970 } | 986 } |
| 971 | 987 |
| 972 - (void)updateSubviewZOrderNormal { | 988 - (void)updateSubviewZOrderNormal { |
| 973 base::scoped_nsobject<NSMutableArray> subviews([[NSMutableArray alloc] init]); | 989 base::scoped_nsobject<NSMutableArray> subviews([[NSMutableArray alloc] init]); |
| 974 if ([downloadShelfController_ view]) | 990 if ([downloadShelfController_ view]) |
| 975 [subviews addObject:[downloadShelfController_ view]]; | 991 [subviews addObject:[downloadShelfController_ view]]; |
| 976 if ([bookmarkBarController_ view]) | 992 if ([bookmarkBarController_ view]) |
| 977 [subviews addObject:[bookmarkBarController_ view]]; | 993 [subviews addObject:[bookmarkBarController_ view]]; |
| 978 if ([toolbarController_ view]) | 994 if ([toolbarController_ view]) |
| 979 [subviews addObject:[toolbarController_ view]]; | 995 [subviews addObject:[toolbarController_ view]]; |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1084 ![[[self window] screen] isEqual:[[NSScreen screens] objectAtIndex:0]]) { | 1100 ![[[self window] screen] isEqual:[[NSScreen screens] objectAtIndex:0]]) { |
| 1085 return NO; | 1101 return NO; |
| 1086 } | 1102 } |
| 1087 | 1103 |
| 1088 return YES; | 1104 return YES; |
| 1089 } | 1105 } |
| 1090 | 1106 |
| 1091 - (NSArray*)customWindowsToEnterFullScreenForWindow:(NSWindow*)window { | 1107 - (NSArray*)customWindowsToEnterFullScreenForWindow:(NSWindow*)window { |
| 1092 DCHECK([window isEqual:self.window]); | 1108 DCHECK([window isEqual:self.window]); |
| 1093 | 1109 |
| 1094 if (![self shouldUseCustomAppKitFullscreenTransition]) | 1110 » windowInitialFrame_ = window.frame; |
| 1095 return nil; | |
| 1096 | 1111 |
| 1097 enterFullscreenTransition_.reset( | 1112 if (![self shouldUseCustomAppKitFullscreenTransition]) { |
| 1098 [[BrowserWindowEnterFullscreenTransition alloc] | 1113 » » return nil; |
| 1099 initWithWindow:self.window]); | 1114 } |
| 1100 return [enterFullscreenTransition_ customWindowsToEnterFullScreen]; | 1115 |
| 1116 » FramedBrowserWindow* framedBrowserWindow = | |
| 1117 » base::mac::ObjCCast<FramedBrowserWindow>([self window]); | |
| 1118 fullscreenTransition_.reset( | |
| 1119 [[BrowserWindowFullscreenTransition alloc] | |
| 1120 initWithWindow:framedBrowserWindow]); | |
| 1121 return [fullscreenTransition_ customWindowsToEnterFullScreenTransition]; | |
| 1101 } | 1122 } |
| 1102 | 1123 |
| 1124 - (NSArray*)customWindowsToExitFullScreenForWindow:(NSWindow*)window { | |
| 1125 DCHECK([window isEqual:self.window]); | |
| 1126 | |
| 1127 if (![self shouldUseCustomAppKitFullscreenTransition]) { | |
| 1128 return nil; | |
| 1129 } | |
| 1130 | |
| 1131 return [fullscreenTransition_ customWindowsToExitFullScreenTransition]; | |
| 1132 } | |
| 1133 | |
| 1134 | |
| 1103 - (void)window:(NSWindow*)window | 1135 - (void)window:(NSWindow*)window |
| 1104 startCustomAnimationToEnterFullScreenWithDuration:(NSTimeInterval)duration { | 1136 startCustomAnimationToEnterFullScreenWithDuration:(NSTimeInterval)duration { |
| 1105 DCHECK([window isEqual:self.window]); | 1137 DCHECK([window isEqual:self.window]); |
| 1106 [enterFullscreenTransition_ | 1138 [fullscreenTransition_ |
| 1107 startCustomAnimationToEnterFullScreenWithDuration:duration]; | 1139 startCustomEnterFullScreenAnimationWithDuration:duration]; |
| 1108 } | 1140 } |
| 1109 | 1141 |
| 1142 - (void)window:(NSWindow*)window | |
| 1143 startCustomAnimationToExitFullScreenWithDuration:(NSTimeInterval)duration { | |
| 1144 DCHECK([window isEqual:self.window]); | |
| 1145 | |
| 1146 [fullscreenTransition_ | |
| 1147 startCustomExitFullScreenAnimationWithDuration:duration]; | |
| 1148 } | |
| 1149 | |
| 1150 | |
| 1110 - (BOOL)shouldConstrainFrameRect { | 1151 - (BOOL)shouldConstrainFrameRect { |
| 1111 if ([enterFullscreenTransition_ shouldWindowBeUnconstrained]) | 1152 if ([fullscreenTransition_ shouldWindowBeUnconstrained]) |
| 1112 return NO; | 1153 return NO; |
| 1113 | 1154 |
| 1114 return [super shouldConstrainFrameRect]; | 1155 return [super shouldConstrainFrameRect]; |
| 1115 } | 1156 } |
| 1116 | 1157 |
| 1117 - (WebContents*)webContents { | 1158 - (WebContents*)webContents { |
| 1118 return browser_->tab_strip_model()->GetActiveWebContents(); | 1159 return browser_->tab_strip_model()->GetActiveWebContents(); |
| 1119 } | 1160 } |
| 1120 | 1161 |
| 1121 - (PermissionBubbleManager*)permissionBubbleManager { | 1162 - (PermissionBubbleManager*)permissionBubbleManager { |
| 1122 if (WebContents* contents = [self webContents]) | 1163 if (WebContents* contents = [self webContents]) |
| 1123 return PermissionBubbleManager::FromWebContents(contents); | 1164 return PermissionBubbleManager::FromWebContents(contents); |
| 1124 return nil; | 1165 return nil; |
| 1125 } | 1166 } |
| 1126 | 1167 |
| 1127 @end // @implementation BrowserWindowController(Private) | 1168 @end // @implementation BrowserWindowController(Private) |
| OLD | NEW |