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

Side by Side Diff: chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm

Issue 11233076: Fix spurious visibility events when committing Instant. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebaseline Created 8 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/tabs/tab_strip_controller.h" 5 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h"
6 6
7 #import <QuartzCore/QuartzCore.h> 7 #import <QuartzCore/QuartzCore.h>
8 8
9 #include <cmath> 9 #include <cmath>
10 #include <limits> 10 #include <limits>
(...skipping 1190 matching lines...) Expand 10 before | Expand all | Expand 10 after
1201 // something similar in |-layoutTabs| confuses the window server. 1201 // something similar in |-layoutTabs| confuses the window server.
1202 [newView setFrame:NSOffsetRect([newView frame], 1202 [newView setFrame:NSOffsetRect([newView frame],
1203 0, -[[self class] defaultTabHeight])]; 1203 0, -[[self class] defaultTabHeight])];
1204 1204
1205 [self setTabTitle:newController withContents:contents->web_contents()]; 1205 [self setTabTitle:newController withContents:contents->web_contents()];
1206 1206
1207 // If a tab is being inserted, we can again use the entire tab strip width 1207 // If a tab is being inserted, we can again use the entire tab strip width
1208 // for layout. 1208 // for layout.
1209 availableResizeWidth_ = kUseFullAvailableWidth; 1209 availableResizeWidth_ = kUseFullAvailableWidth;
1210 1210
1211 [delegate_ onInsertTabWithContents:contents->web_contents()];
1212
1213 // We don't need to call |-layoutTabs| if the tab will be in the foreground 1211 // We don't need to call |-layoutTabs| if the tab will be in the foreground
1214 // because it will get called when the new tab is selected by the tab model. 1212 // because it will get called when the new tab is selected by the tab model.
1215 // Whenever |-layoutTabs| is called, it'll also add the new subview. 1213 // Whenever |-layoutTabs| is called, it'll also add the new subview.
1216 if (!inForeground) { 1214 if (!inForeground) {
1217 [self layoutTabs]; 1215 [self layoutTabs];
1218 } 1216 }
1219 1217
1220 // During normal loading, we won't yet have a favicon and we'll get 1218 // During normal loading, we won't yet have a favicon and we'll get
1221 // subsequent state change notifications to show the throbber, but when we're 1219 // subsequent state change notifications to show the throbber, but when we're
1222 // dragging a tab out into a new window, we have to put the tab's favicon 1220 // dragging a tab out into a new window, we have to put the tab's favicon
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1299 // Simply create a new TabContentsController for |newContents| and place it 1297 // Simply create a new TabContentsController for |newContents| and place it
1300 // into the array, replacing |oldContents|. A ActiveTabChanged notification 1298 // into the array, replacing |oldContents|. A ActiveTabChanged notification
1301 // will follow, at which point we will install the new view. 1299 // will follow, at which point we will install the new view.
1302 scoped_nsobject<TabContentsController> newController( 1300 scoped_nsobject<TabContentsController> newController(
1303 [[TabContentsController alloc] 1301 [[TabContentsController alloc]
1304 initWithContents:newContents->web_contents()]); 1302 initWithContents:newContents->web_contents()]);
1305 1303
1306 // Bye bye, |oldController|. 1304 // Bye bye, |oldController|.
1307 [tabContentsArray_ replaceObjectAtIndex:index withObject:newController]; 1305 [tabContentsArray_ replaceObjectAtIndex:index withObject:newController];
1308 1306
1309 [delegate_ onReplaceTabWithContents:newContents->web_contents()];
1310
1311 // Fake a tab changed notification to force tab titles and favicons to update. 1307 // Fake a tab changed notification to force tab titles and favicons to update.
1312 [self tabChangedWithContents:newContents 1308 [self tabChangedWithContents:newContents
1313 atIndex:modelIndex 1309 atIndex:modelIndex
1314 changeType:TabStripModelObserver::ALL]; 1310 changeType:TabStripModelObserver::ALL];
1315 } 1311 }
1316 1312
1317 // Remove all knowledge about this tab and its associated controller, and remove 1313 // Remove all knowledge about this tab and its associated controller, and remove
1318 // the view from the strip. 1314 // the view from the strip.
1319 - (void)removeTab:(TabController*)controller { 1315 - (void)removeTab:(TabController*)controller {
1320 // Cancel any pending tab transition. 1316 // Cancel any pending tab transition.
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after
2111 NSView* GetSheetParentViewForWebContents(WebContents* web_contents) { 2107 NSView* GetSheetParentViewForWebContents(WebContents* web_contents) {
2112 // View hierarchy of the contents view: 2108 // View hierarchy of the contents view:
2113 // NSView -- switchView, same for all tabs 2109 // NSView -- switchView, same for all tabs
2114 // +- NSView -- TabContentsController's view 2110 // +- NSView -- TabContentsController's view
2115 // +- TabContentsViewCocoa 2111 // +- TabContentsViewCocoa
2116 // 2112 //
2117 // Changing it? Do not forget to modify 2113 // Changing it? Do not forget to modify
2118 // -[TabStripController swapInTabAtIndex:] too. 2114 // -[TabStripController swapInTabAtIndex:] too.
2119 return [web_contents->GetNativeView() superview]; 2115 return [web_contents->GetNativeView() superview];
2120 } 2116 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/tabs/tab_strip_controller.h ('k') | chrome/browser/ui/cocoa/tabs/tab_strip_controller_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698