summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa
diff options
context:
space:
mode:
authorrohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-05 14:57:56 +0000
committerrohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-05 14:57:56 +0000
commit0f54231d9c2df3a6ed07ecd97886af8d28705df5 (patch)
treea1c624956db172d4933fda182a33c31e55d4627e /chrome/browser/cocoa
parent8643163bd70d444b192e544616add93e46113d12 (diff)
downloadchromium_src-0f54231d9c2df3a6ed07ecd97886af8d28705df5.zip
chromium_src-0f54231d9c2df3a6ed07ecd97886af8d28705df5.tar.gz
chromium_src-0f54231d9c2df3a6ed07ecd97886af8d28705df5.tar.bz2
[Mac] Insert views into the proper place in the view hierarchy when tearing off tabs.
BUG=http://crbug.com/19320 BUG=http://crbug.com/23407 BUG=http://crbug.com/20555 TEST=Tearing off a tab with an open infobar should not show a blank transparent space. After tearing off a tab, both find in page and fullscreen should work properly. Review URL: http://codereview.chromium.org/258012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27992 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa')
-rw-r--r--chrome/browser/cocoa/browser_window_controller.mm11
-rw-r--r--chrome/browser/cocoa/tab_window_controller.h5
-rw-r--r--chrome/browser/cocoa/tab_window_controller.mm23
3 files changed, 11 insertions, 28 deletions
diff --git a/chrome/browser/cocoa/browser_window_controller.mm b/chrome/browser/cocoa/browser_window_controller.mm
index 32dd545..43ffa11 100644
--- a/chrome/browser/cocoa/browser_window_controller.mm
+++ b/chrome/browser/cocoa/browser_window_controller.mm
@@ -1148,17 +1148,6 @@ willPositionSheet:(NSWindow*)sheet
return defaultSheetRect;
}
-// In addition to the tab strip and content area, which the superview's impl
-// takes care of, we need to add the toolbar and bookmark bar to the
-// overlay so they draw correctly when dragging out a new window.
-- (NSArray*)viewsToMoveToOverlay {
- NSArray* views = [super viewsToMoveToOverlay];
- NSArray* browserViews =
- [NSArray arrayWithObjects:[toolbarController_ view],
- nil];
- return [views arrayByAddingObjectsFromArray:browserViews];
-}
-
// Undocumented method for multi-touch gestures in 10.5. Future OS's will
// likely add a public API, but the worst that will happen is that this will
// turn into dead code and just won't get called.
diff --git a/chrome/browser/cocoa/tab_window_controller.h b/chrome/browser/cocoa/tab_window_controller.h
index 17c1a543..ed3c23b 100644
--- a/chrome/browser/cocoa/tab_window_controller.h
+++ b/chrome/browser/cocoa/tab_window_controller.h
@@ -123,11 +123,6 @@
@end
@interface TabWindowController(ProtectedMethods)
-// A list of all the views that need to move to the overlay window. Subclasses
-// can override this to add more things besides the tab strip. Be sure to
-// call the superclass' version if overridden.
-- (NSArray*)viewsToMoveToOverlay;
-
// Tells the tab strip to forget about this tab in preparation for it being
// put into a different tab strip, such as during a drop on another window.
- (void)detachTabView:(NSView*)view;
diff --git a/chrome/browser/cocoa/tab_window_controller.mm b/chrome/browser/cocoa/tab_window_controller.mm
index e405887..7ca47ea 100644
--- a/chrome/browser/cocoa/tab_window_controller.mm
+++ b/chrome/browser/cocoa/tab_window_controller.mm
@@ -60,20 +60,21 @@
[self setUseOverlay:YES];
}
-- (NSArray*)viewsToMoveToOverlay {
- return [NSArray arrayWithObjects:[self tabStripView],
- [self tabContentArea], nil];
-}
-
// if |useOverlay| is true, we're moving views into the overlay's content
// area. If false, we're moving out of the overlay back into the window's
// content.
- (void)moveViewsBetweenWindowAndOverlay:(BOOL)useOverlay {
- NSView* moveTo = useOverlay ?
- [overlayWindow_ contentView] : [cachedContentView_ superview];
- NSArray* viewsToMove = [self viewsToMoveToOverlay];
- for (NSView* view in viewsToMove)
- [moveTo addSubview:view];
+ if (useOverlay) {
+ [[[overlayWindow_ contentView] superview] addSubview:[self tabStripView]];
+ // Add the original window's content view as a subview of the overlay
+ // window's content view. We cannot simply use setContentView: here because
+ // the overlay window has a different content size (due to it being
+ // borderless).
+ [[overlayWindow_ contentView] addSubview:cachedContentView_];
+ } else {
+ [[[[self window] contentView] superview] addSubview:[self tabStripView]];
+ [[self window] setContentView:cachedContentView_];
+ }
}
// If |useOverlay| is YES, creates a new overlay window and puts the tab strip
@@ -95,8 +96,6 @@
[overlayWindow_ setBackgroundColor:[NSColor clearColor]];
[overlayWindow_ setOpaque:NO];
[overlayWindow_ setDelegate:self];
- NSView *contentView = [overlayWindow_ contentView];
- [contentView addSubview:[self tabStripView]];
cachedContentView_ = [[self window] contentView];
[self moveViewsBetweenWindowAndOverlay:useOverlay];
[[self window] addChildWindow:overlayWindow_ ordered:NSWindowAbove];