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/mac_util.h" | 10 #include "base/mac/mac_util.h" |
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
560 [self disableBarVisibilityUpdates]; | 560 [self disableBarVisibilityUpdates]; |
561 | 561 |
562 // Retain the tab strip view while we remove it from its superview. | 562 // Retain the tab strip view while we remove it from its superview. |
563 base::scoped_nsobject<NSView> tabStripView; | 563 base::scoped_nsobject<NSView> tabStripView; |
564 if ([self hasTabStrip]) { | 564 if ([self hasTabStrip]) { |
565 tabStripView.reset([[self tabStripView] retain]); | 565 tabStripView.reset([[self tabStripView] retain]); |
566 [tabStripView removeFromSuperview]; | 566 [tabStripView removeFromSuperview]; |
567 } | 567 } |
568 | 568 |
569 // Ditto for the content view. | 569 // Ditto for the content view. |
570 base::scoped_nsobject<NSView> contentView( | 570 base::scoped_nsobject<NSView> contentView([self.chromeContentView retain]); |
571 [[sourceWindow contentView] retain]); | |
572 // Disable autoresizing of subviews while we move views around. This prevents | 571 // Disable autoresizing of subviews while we move views around. This prevents |
573 // spurious renderer resizes. | 572 // spurious renderer resizes. |
574 [contentView setAutoresizesSubviews:NO]; | 573 [contentView setAutoresizesSubviews:NO]; |
575 [contentView removeFromSuperview]; | 574 [contentView removeFromSuperview]; |
576 | 575 |
577 // Have to do this here, otherwise later calls can crash because the window | 576 // Have to do this here, otherwise later calls can crash because the window |
578 // has no delegate. | 577 // has no delegate. |
579 [sourceWindow setDelegate:nil]; | 578 [sourceWindow setDelegate:nil]; |
580 [destWindow setDelegate:self]; | 579 [destWindow setDelegate:self]; |
581 | 580 |
582 // With this call, valgrind complains that a "Conditional jump or move depends | 581 // With this call, valgrind complains that a "Conditional jump or move depends |
583 // on uninitialised value(s)". The error happens in -[NSThemeFrame | 582 // on uninitialised value(s)". The error happens in -[NSThemeFrame |
584 // drawOverlayRect:]. I'm pretty convinced this is an Apple bug, but there is | 583 // drawOverlayRect:]. I'm pretty convinced this is an Apple bug, but there is |
585 // no visual impact. I have been unable to tickle it away with other window | 584 // no visual impact. I have been unable to tickle it away with other window |
586 // or view manipulation Cocoa calls. Stack added to suppressions_mac.txt. | 585 // or view manipulation Cocoa calls. Stack added to suppressions_mac.txt. |
587 [contentView setAutoresizesSubviews:YES]; | 586 [contentView setAutoresizesSubviews:YES]; |
588 [destWindow setContentView:contentView]; | 587 [[destWindow contentView] addSubview:contentView |
588 positioned:NSWindowBelow | |
589 relativeTo:nil]; | |
589 | 590 |
590 // Move the incognito badge if present. | 591 // Move the incognito badge if present. |
591 if ([self shouldShowAvatar]) { | 592 if ([self shouldShowAvatar]) { |
592 NSView* avatarButtonView = [avatarButtonController_ view]; | 593 NSView* avatarButtonView = [avatarButtonController_ view]; |
593 | 594 |
594 [avatarButtonView removeFromSuperview]; | 595 [avatarButtonView removeFromSuperview]; |
595 [avatarButtonView setHidden:YES]; // Will be shown in layout. | 596 [avatarButtonView setHidden:YES]; // Will be shown in layout. |
596 [[destWindow cr_windowView] addSubview:avatarButtonView]; | 597 [[destWindow cr_windowView] addSubview:avatarButtonView]; |
597 } | 598 } |
598 | 599 |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
845 | 846 |
846 - (void)windowDidEnterFullScreen:(NSNotification*)notification { | 847 - (void)windowDidEnterFullScreen:(NSNotification*)notification { |
847 // In Yosemite, some combination of the titlebar and toolbar always show in | 848 // In Yosemite, some combination of the titlebar and toolbar always show in |
848 // full-screen mode. We do not want either to show. Search for the window that | 849 // full-screen mode. We do not want either to show. Search for the window that |
849 // contains the views, and hide it. There is no need to ever unhide the view. | 850 // contains the views, and hide it. There is no need to ever unhide the view. |
850 // http://crbug.com/380235 | 851 // http://crbug.com/380235 |
851 if (base::mac::IsOSYosemiteOrLater()) { | 852 if (base::mac::IsOSYosemiteOrLater()) { |
852 for (NSWindow* window in [[NSApplication sharedApplication] windows]) { | 853 for (NSWindow* window in [[NSApplication sharedApplication] windows]) { |
853 if ([window | 854 if ([window |
854 isKindOfClass:NSClassFromString(@"NSToolbarFullScreenWindow")]) { | 855 isKindOfClass:NSClassFromString(@"NSToolbarFullScreenWindow")]) { |
855 [window.contentView setHidden:YES]; | 856 [[window contentView] setHidden:YES]; |
856 } | 857 } |
857 } | 858 } |
858 } | 859 } |
859 | 860 |
860 if (notification) // For System Fullscreen when non-nil. | 861 if (notification) // For System Fullscreen when non-nil. |
861 [self deregisterForContentViewResizeNotifications]; | 862 [self deregisterForContentViewResizeNotifications]; |
862 enteringFullscreen_ = NO; | 863 enteringFullscreen_ = NO; |
863 enteringPresentationMode_ = NO; | 864 enteringPresentationMode_ = NO; |
864 | 865 |
865 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 866 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
923 | 924 |
924 barVisibilityUpdatesEnabled_ = NO; | 925 barVisibilityUpdatesEnabled_ = NO; |
925 [presentationModeController_ cancelAnimationAndTimers]; | 926 [presentationModeController_ cancelAnimationAndTimers]; |
926 } | 927 } |
927 | 928 |
928 - (CGFloat)toolbarDividerOpacity { | 929 - (CGFloat)toolbarDividerOpacity { |
929 return [bookmarkBarController_ toolbarDividerOpacity]; | 930 return [bookmarkBarController_ toolbarDividerOpacity]; |
930 } | 931 } |
931 | 932 |
932 - (void)updateSubviewZOrder:(BOOL)inPresentationMode { | 933 - (void)updateSubviewZOrder:(BOOL)inPresentationMode { |
933 NSView* contentView = [[self window] contentView]; | 934 NSView* contentView = self.chromeContentView; |
934 NSView* toolbarView = [toolbarController_ view]; | 935 NSView* toolbarView = [toolbarController_ view]; |
935 | 936 |
936 if (inPresentationMode) { | 937 if (inPresentationMode) { |
937 // Toolbar is above tab contents so that it can slide down from top of | 938 // Toolbar is above tab contents so that it can slide down from top of |
938 // screen. | 939 // screen. |
939 [contentView cr_ensureSubview:toolbarView | 940 [contentView cr_ensureSubview:toolbarView |
940 isPositioned:NSWindowAbove | 941 isPositioned:NSWindowAbove |
941 relativeTo:[self tabContentArea]]; | 942 relativeTo:[self tabContentArea]]; |
942 } else { | 943 } else { |
943 // Toolbar is below tab contents so that the info bar arrow can appear above | 944 // Toolbar is below tab contents so that the info bar arrow can appear above |
(...skipping 26 matching lines...) Expand all Loading... | |
970 NSView* relativeView = nil; | 971 NSView* relativeView = nil; |
971 if (inPresentationMode) | 972 if (inPresentationMode) |
972 relativeView = toolbarView; | 973 relativeView = toolbarView; |
973 else | 974 else |
974 relativeView = [self tabContentArea]; | 975 relativeView = [self tabContentArea]; |
975 [contentView cr_ensureSubview:[findBarCocoaController_ view] | 976 [contentView cr_ensureSubview:[findBarCocoaController_ view] |
976 isPositioned:NSWindowAbove | 977 isPositioned:NSWindowAbove |
977 relativeTo:relativeView]; | 978 relativeTo:relativeView]; |
978 } | 979 } |
979 | 980 |
980 if (floatingBarBackingView_) { | 981 if (floatingBarBackingView_) { |
Andre
2014/07/11 00:57:11
I think this floatingBarBackingView_ is placed in
erikchen
2014/07/11 01:17:43
The floatingBarBackingView gets used in presentati
| |
981 if ([floatingBarBackingView_ cr_isBelowView:[self tabContentArea]]) | 982 if ([floatingBarBackingView_ cr_isBelowView:[self tabContentArea]]) |
982 [floatingBarBackingView_ removeFromSuperview]; | 983 [floatingBarBackingView_ removeFromSuperview]; |
983 if ([self placeBookmarkBarBelowInfoBar]) { | 984 if ([self placeBookmarkBarBelowInfoBar]) { |
984 [contentView cr_ensureSubview:floatingBarBackingView_ | 985 [contentView cr_ensureSubview:floatingBarBackingView_ |
985 isPositioned:NSWindowAbove | 986 isPositioned:NSWindowAbove |
986 relativeTo:[bookmarkBarController_ view]]; | 987 relativeTo:[bookmarkBarController_ view]]; |
987 } else { | 988 } else { |
988 [contentView cr_ensureSubview:floatingBarBackingView_ | 989 [contentView cr_ensureSubview:floatingBarBackingView_ |
989 isPositioned:NSWindowBelow | 990 isPositioned:NSWindowBelow |
990 relativeTo:[bookmarkBarController_ view]]; | 991 relativeTo:[bookmarkBarController_ view]]; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1026 devTools->SetAllowOverlappingViews(allowOverlappingViews); | 1027 devTools->SetAllowOverlappingViews(allowOverlappingViews); |
1027 } | 1028 } |
1028 | 1029 |
1029 - (void)updateInfoBarTipVisibility { | 1030 - (void)updateInfoBarTipVisibility { |
1030 // If there's no toolbar then hide the infobar tip. | 1031 // If there's no toolbar then hide the infobar tip. |
1031 [infoBarContainerController_ | 1032 [infoBarContainerController_ |
1032 setShouldSuppressTopInfoBarTip:![self hasToolbar]]; | 1033 setShouldSuppressTopInfoBarTip:![self hasToolbar]]; |
1033 } | 1034 } |
1034 | 1035 |
1035 @end // @implementation BrowserWindowController(Private) | 1036 @end // @implementation BrowserWindowController(Private) |
OLD | NEW |