summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa
diff options
context:
space:
mode:
authorrohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-22 18:41:34 +0000
committerrohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-22 18:41:34 +0000
commitc57a65632f3e4cabc45f380b77d7141c7f9b0a27 (patch)
tree1d58a13e2496c19ed4a76a9e1b9e28a7131890ff /chrome/browser/cocoa
parent1279d5f395182c6fa783da0d85216777d931af6b (diff)
downloadchromium_src-c57a65632f3e4cabc45f380b77d7141c7f9b0a27.zip
chromium_src-c57a65632f3e4cabc45f380b77d7141c7f9b0a27.tar.gz
chromium_src-c57a65632f3e4cabc45f380b77d7141c7f9b0a27.tar.bz2
Adds a missing call to TabContents::WasHidden() on Mac.
Consolidates the WasHidden/DidBecomeSelected logic into a single method. This change is needed to make the hung renderer dialog disappear when switching tabs. BUG=None TEST=None Review URL: http://codereview.chromium.org/141048 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18926 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa')
-rw-r--r--chrome/browser/cocoa/browser_window_controller.mm1
-rw-r--r--chrome/browser/cocoa/tab_strip_controller.mm26
2 files changed, 15 insertions, 12 deletions
diff --git a/chrome/browser/cocoa/browser_window_controller.mm b/chrome/browser/cocoa/browser_window_controller.mm
index 0401644..91a356f 100644
--- a/chrome/browser/cocoa/browser_window_controller.mm
+++ b/chrome/browser/cocoa/browser_window_controller.mm
@@ -609,7 +609,6 @@ willPositionSheet:(NSWindow *)sheet
infobar_container_->ChangeTabContents(new_contents);
contents_container_->SetTabContents(new_contents);
#endif
- newContents->DidBecomeSelected();
// Update all the UI bits.
windowShim_->UpdateTitleBar();
diff --git a/chrome/browser/cocoa/tab_strip_controller.mm b/chrome/browser/cocoa/tab_strip_controller.mm
index b54de92..90fced55 100644
--- a/chrome/browser/cocoa/tab_strip_controller.mm
+++ b/chrome/browser/cocoa/tab_strip_controller.mm
@@ -223,11 +223,11 @@ NSString* const kTabStripNumberOfTabsChanged = @"kTabStripNumberOfTabsChanged";
//tabFrame.size.height += 10.0 * placeholderStretchiness_;
[[[tab view] animator] setFrame:tabFrame];
[NSAnimationContext endGrouping];
-
+
// Store the frame by identifier to aviod redundant calls to animator.
NSValue *identifier = [NSValue valueWithPointer:[tab view]];
[targetFrames_ setObject:[NSValue valueWithRect:tabFrame]
- forKey:identifier];
+ forKey:identifier];
continue;
} else {
// If our left edge is to the left of the placeholder's left, but our mid
@@ -246,7 +246,7 @@ NSString* const kTabStripNumberOfTabsChanged = @"kTabStripNumberOfTabsChanged";
id frameTarget = visible ? [[tab view] animator] : [tab view];
tabFrame.size.width = [tab selected] ? kMaxTabWidth : baseTabWidth;
-
+
// Check the frame by identifier to avoid redundant calls to animator.
NSValue *identifier = [NSValue valueWithPointer:[tab view]];
NSValue *oldTargetValue = [targetFrames_ objectForKey:identifier];
@@ -254,7 +254,7 @@ NSString* const kTabStripNumberOfTabsChanged = @"kTabStripNumberOfTabsChanged";
!NSEqualRects([oldTargetValue rectValue], tabFrame)) {
[frameTarget setFrame:tabFrame];
[targetFrames_ setObject:[NSValue valueWithRect:tabFrame]
- forKey:identifier];
+ forKey:identifier];
}
enclosingRect = NSUnionRect(tabFrame, enclosingRect);
}
@@ -265,16 +265,16 @@ NSString* const kTabStripNumberOfTabsChanged = @"kTabStripNumberOfTabsChanged";
}
i++;
}
-
+
NSRect newTabNewFrame = [newTabButton_ frame];
newTabNewFrame.origin =
NSMakePoint(MIN(availableWidth, offset + kNewTabButtonOffset), 0);
newTabNewFrame.origin.x = MAX(newTabNewFrame.origin.x,
NSMaxX(placeholderFrame_));
- if (i > 0 && [newTabButton_ isHidden]) {
+ if (i > 0 && [newTabButton_ isHidden]) {
[[newTabButton_ animator] setHidden:NO];
}
-
+
if (!NSEqualRects(newTabTargetFrame_, newTabNewFrame)) {
[newTabButton_ setFrame:newTabNewFrame];
newTabTargetFrame_ = newTabNewFrame;
@@ -341,7 +341,7 @@ NSString* const kTabStripNumberOfTabsChanged = @"kTabStripNumberOfTabsChanged";
if (!inForeground) {
[self layoutTabs];
}
-
+
// Send a broadcast that the number of tabs have changed.
[[NSNotificationCenter defaultCenter]
postNotificationName:kTabStripNumberOfTabsChanged
@@ -375,14 +375,18 @@ NSString* const kTabStripNumberOfTabsChanged = @"kTabStripNumberOfTabsChanged";
// size than surrounding tabs if the user has many.
[self layoutTabs];
- if (oldContents)
+ if (oldContents) {
oldContents->view()->StoreFocus();
+ oldContents->WasHidden();
+ }
// Swap in the contents for the new tab
[self swapInTabAtIndex:index];
- if (newContents)
+ if (newContents) {
+ newContents->DidBecomeSelected();
newContents->view()->RestoreFocus();
+ }
}
// Called when a notification is received from the model that the given tab
@@ -493,7 +497,7 @@ NSString* const kTabStripNumberOfTabsChanged = @"kTabStripNumberOfTabsChanged";
NSView *view = [self selectedTabView];
NSValue *identifier = [NSValue valueWithPointer:view];
[targetFrames_ setObject:[NSValue valueWithRect:frame]
- forKey:identifier];
+ forKey:identifier];
[view setFrame:frame];
}