| OLD | NEW |
| 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 Loading... |
| 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 |
| 1211 // We don't need to call |-layoutTabs| if the tab will be in the foreground | 1213 // We don't need to call |-layoutTabs| if the tab will be in the foreground |
| 1212 // because it will get called when the new tab is selected by the tab model. | 1214 // because it will get called when the new tab is selected by the tab model. |
| 1213 // Whenever |-layoutTabs| is called, it'll also add the new subview. | 1215 // Whenever |-layoutTabs| is called, it'll also add the new subview. |
| 1214 if (!inForeground) { | 1216 if (!inForeground) { |
| 1215 [self layoutTabs]; | 1217 [self layoutTabs]; |
| 1216 } | 1218 } |
| 1217 | 1219 |
| 1218 // During normal loading, we won't yet have a favicon and we'll get | 1220 // During normal loading, we won't yet have a favicon and we'll get |
| 1219 // subsequent state change notifications to show the throbber, but when we're | 1221 // subsequent state change notifications to show the throbber, but when we're |
| 1220 // dragging a tab out into a new window, we have to put the tab's favicon | 1222 // dragging a tab out into a new window, we have to put the tab's favicon |
| (...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2109 NSView* GetSheetParentViewForTabContents(TabContents* tab_contents) { | 2111 NSView* GetSheetParentViewForTabContents(TabContents* tab_contents) { |
| 2110 // View hierarchy of the contents view: | 2112 // View hierarchy of the contents view: |
| 2111 // NSView -- switchView, same for all tabs | 2113 // NSView -- switchView, same for all tabs |
| 2112 // +- NSView -- TabContentsController's view | 2114 // +- NSView -- TabContentsController's view |
| 2113 // +- TabContentsViewCocoa | 2115 // +- TabContentsViewCocoa |
| 2114 // | 2116 // |
| 2115 // Changing it? Do not forget to modify | 2117 // Changing it? Do not forget to modify |
| 2116 // -[TabStripController swapInTabAtIndex:] too. | 2118 // -[TabStripController swapInTabAtIndex:] too. |
| 2117 return [tab_contents->web_contents()->GetNativeView() superview]; | 2119 return [tab_contents->web_contents()->GetNativeView() superview]; |
| 2118 } | 2120 } |
| OLD | NEW |