summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorpinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-07 14:12:44 +0000
committerpinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-07 14:12:44 +0000
commit01d3492b9b53163d2acf3b6cd8e0764c8ed6f08f (patch)
tree841d5bdc09f8cf059ed84a79597e5c2b61c9ce6e /chrome
parentbb4a2247bb57117fd5c6cc402264a1ce12afeec7 (diff)
downloadchromium_src-01d3492b9b53163d2acf3b6cd8e0764c8ed6f08f.zip
chromium_src-01d3492b9b53163d2acf3b6cd8e0764c8ed6f08f.tar.gz
chromium_src-01d3492b9b53163d2acf3b6cd8e0764c8ed6f08f.tar.bz2
Layout the tabs explicitly when creating a background tab. Update to correct tab model observer API so we once again get update messages.
Review URL: http://codereview.chromium.org/63022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13249 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/cocoa/tab_strip_controller.mm32
1 files changed, 20 insertions, 12 deletions
diff --git a/chrome/browser/cocoa/tab_strip_controller.mm b/chrome/browser/cocoa/tab_strip_controller.mm
index 46a98df..d29702b 100644
--- a/chrome/browser/cocoa/tab_strip_controller.mm
+++ b/chrome/browser/cocoa/tab_strip_controller.mm
@@ -28,7 +28,8 @@
- (void)tabDetachedWithContents:(TabContents*)contents
atIndex:(NSInteger)index;
- (void)tabChangedWithContents:(TabContents*)contents
- atIndex:(NSInteger)index;
+ atIndex:(NSInteger)index
+ loadingOnly:(BOOL)loading;
@end
// A C++ bridge class to handle receiving notifications from the C++ tab
@@ -51,7 +52,8 @@ class TabStripBridge : public TabStripModelObserver {
virtual void TabMoved(TabContents* contents,
int from_index,
int to_index);
- virtual void TabChangedAt(TabContents* contents, int index);
+ virtual void TabChangedAt(TabContents* contents, int index,
+ bool loading_only);
virtual void TabStripEmpty();
private:
@@ -274,19 +276,21 @@ class TabStripBridge : public TabStripModelObserver {
[contentsController toggleBookmarkBar:YES];
[tabContentsArray_ insertObject:contentsController atIndex:index];
- // Make a new tab and add it to the strip. Keep track of its controller. We
- // don't call |-layoutTabs| here because it will get called when the new
- // tab is selected by the tab model.
+ // Make a new tab and add it to the strip. Keep track of its controller.
TabController* newController = [self newTab];
[tabArray_ insertObject:newController atIndex:index];
NSView* newView = [newController view];
- [tabView_ addSubview:newView];
+ [tabView_ addSubview:newView
+ positioned:inForeground ? NSWindowAbove : NSWindowBelow
+ relativeTo:nil];
[self setTabTitle:newController withContents:contents];
- // Select the newly created tab if in the foreground
- if (inForeground)
- [self swapInTabAtIndex:index];
+ // We don't need to call |-layoutTabs| if the tab will be in the foreground
+ // because it will get called when the new tab is selected by the tab model.
+ if (!inForeground) {
+ [self layoutTabs];
+ }
}
// Called when a notification is received from the model to select a particular
@@ -344,7 +348,8 @@ class TabStripBridge : public TabStripModelObserver {
// Called when a notification is received from the model that the given tab
// has been updated.
- (void)tabChangedWithContents:(TabContents*)contents
- atIndex:(NSInteger)index {
+ atIndex:(NSInteger)index
+ loadingOnly:(BOOL)loading {
[self setTabTitle:[tabArray_ objectAtIndex:index] withContents:contents];
TabContentsController* updatedController =
@@ -472,8 +477,11 @@ void TabStripBridge::TabMoved(TabContents* contents,
NOTIMPLEMENTED();
}
-void TabStripBridge::TabChangedAt(TabContents* contents, int index) {
- [controller_ tabChangedWithContents:contents atIndex:index];
+void TabStripBridge::TabChangedAt(TabContents* contents, int index,
+ bool loading_only) {
+ [controller_ tabChangedWithContents:contents
+ atIndex:index
+ loadingOnly:loading_only ? YES : NO];
}
void TabStripBridge::TabStripEmpty() {