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

Unified Diff: chrome/browser/ui/cocoa/browser_window_controller_private.mm

Issue 646703002: mac: Use a full-size content view (reland 1). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments from avi. Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/browser_window_controller_private.mm
diff --git a/chrome/browser/ui/cocoa/browser_window_controller_private.mm b/chrome/browser/ui/cocoa/browser_window_controller_private.mm
index 8dd4f36cd8f3e6637a4dc67edcc605b3db301b24..0c13d31624b3439cc0b23a2227b333b0f2adb28f 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller_private.mm
+++ b/chrome/browser/ui/cocoa/browser_window_controller_private.mm
@@ -288,13 +288,10 @@ willPositionSheet:(NSWindow*)sheet
[tabStripView removeFromSuperview];
}
- // Ditto for the content view.
- base::scoped_nsobject<NSView> contentView(
- [[sourceWindow contentView] retain]);
// Disable autoresizing of subviews while we move views around. This prevents
// spurious renderer resizes.
- [contentView setAutoresizesSubviews:NO];
- [contentView removeFromSuperview];
+ [self.chromeContentView setAutoresizesSubviews:NO];
+ [self.chromeContentView removeFromSuperview];
// Have to do this here, otherwise later calls can crash because the window
// has no delegate.
@@ -306,9 +303,11 @@ willPositionSheet:(NSWindow*)sheet
// drawOverlayRect:]. I'm pretty convinced this is an Apple bug, but there is
// no visual impact. I have been unable to tickle it away with other window
// or view manipulation Cocoa calls. Stack added to suppressions_mac.txt.
- [contentView setAutoresizesSubviews:YES];
- [destWindow setContentView:contentView];
- [self moveContentViewToBack:contentView];
+ [self.chromeContentView setAutoresizesSubviews:YES];
+ [[destWindow contentView] addSubview:self.chromeContentView
+ positioned:NSWindowBelow
+ relativeTo:nil];
+ [self.chromeContentView setFrame:[[destWindow contentView] bounds]];
// Move the incognito badge if present.
if ([self shouldShowAvatar]) {
@@ -322,7 +321,7 @@ willPositionSheet:(NSWindow*)sheet
// Add the tab strip after setting the content view and moving the incognito
// badge (if any), so that the tab strip will be on top (in the z-order).
if ([self hasTabStrip])
- [self insertTabStripView:tabStripView intoWindow:[self window]];
+ [self insertTabStripView:tabStripView intoWindow:destWindow];
[sourceWindow setWindowController:nil];
[self setWindow:destWindow];
@@ -626,7 +625,7 @@ willPositionSheet:(NSWindow*)sheet
for (NSWindow* window in [[NSApplication sharedApplication] windows]) {
if ([window
isKindOfClass:NSClassFromString(@"NSToolbarFullScreenWindow")]) {
- [window.contentView setHidden:YES];
+ [[window contentView] setHidden:YES];
}
}
}
@@ -912,18 +911,18 @@ willPositionSheet:(NSWindow*)sheet
- (void)setContentViewSubviews:(NSArray*)subviews {
// Subviews already match.
- if ([[self.window.contentView subviews] isEqual:subviews])
+ if ([[self.chromeContentView subviews] isEqual:subviews])
return;
// The tabContentArea isn't a subview, so just set all the subviews.
NSView* tabContentArea = [self tabContentArea];
- if (![[self.window.contentView subviews] containsObject:tabContentArea]) {
- [self.window.contentView setSubviews:subviews];
+ if (![[self.chromeContentView subviews] containsObject:tabContentArea]) {
+ [self.chromeContentView setSubviews:subviews];
return;
}
// Remove all subviews that aren't the tabContentArea.
- for (NSView* view in [[self.window.contentView subviews] copy]) {
+ for (NSView* view in [[self.chromeContentView subviews] copy]) {
if (view != tabContentArea)
[view removeFromSuperview];
}
@@ -932,17 +931,17 @@ willPositionSheet:(NSWindow*)sheet
NSInteger index = [subviews indexOfObject:tabContentArea];
for (int i = index - 1; i >= 0; --i) {
NSView* view = [subviews objectAtIndex:i];
- [self.window.contentView addSubview:view
- positioned:NSWindowBelow
- relativeTo:nil];
+ [self.chromeContentView addSubview:view
+ positioned:NSWindowBelow
+ relativeTo:nil];
}
// Add in the subviews above the tabContentArea.
for (NSUInteger i = index + 1; i < [subviews count]; ++i) {
NSView* view = [subviews objectAtIndex:i];
- [self.window.contentView addSubview:view
- positioned:NSWindowAbove
- relativeTo:nil];
+ [self.chromeContentView addSubview:view
+ positioned:NSWindowAbove
+ relativeTo:nil];
}
}

Powered by Google App Engine
This is Rietveld 408576698