| 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 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 for (TabController* controller in closingControllers_.get()) { | 510 for (TabController* controller in closingControllers_.get()) { |
| 511 NSView* view = [controller view]; | 511 NSView* view = [controller view]; |
| 512 [[[view animationForKey:@"frameOrigin"] delegate] invalidate]; | 512 [[[view animationForKey:@"frameOrigin"] delegate] invalidate]; |
| 513 } | 513 } |
| 514 [[NSNotificationCenter defaultCenter] removeObserver:self]; | 514 [[NSNotificationCenter defaultCenter] removeObserver:self]; |
| 515 [tabStripView_ removeAllToolTips]; | 515 [tabStripView_ removeAllToolTips]; |
| 516 [super dealloc]; | 516 [super dealloc]; |
| 517 } | 517 } |
| 518 | 518 |
| 519 + (CGFloat)defaultTabHeight { | 519 + (CGFloat)defaultTabHeight { |
| 520 return 25.0; | 520 return 26.0; |
| 521 } | 521 } |
| 522 | 522 |
| 523 + (CGFloat)defaultLeftIndentForControls { | 523 + (CGFloat)defaultLeftIndentForControls { |
| 524 // Default indentation leaves enough room so tabs don't overlap with the | 524 // Default indentation leaves enough room so tabs don't overlap with the |
| 525 // window controls. | 525 // window controls. |
| 526 return 70.0; | 526 return 70.0; |
| 527 } | 527 } |
| 528 | 528 |
| 529 // Finds the TabContentsController associated with the given index into the tab | 529 // Finds the TabContentsController associated with the given index into the tab |
| 530 // model and swaps out the sole child of the contentArea to display its | 530 // model and swaps out the sole child of the contentArea to display its |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 963 // them to correspond with the new tab positions. | 963 // them to correspond with the new tab positions. |
| 964 [tabStripView_ removeAllToolTips]; | 964 [tabStripView_ removeAllToolTips]; |
| 965 | 965 |
| 966 for (TabController* tab in tabArray_.get()) { | 966 for (TabController* tab in tabArray_.get()) { |
| 967 // Ignore a tab that is going through a close animation. | 967 // Ignore a tab that is going through a close animation. |
| 968 if ([closingControllers_ containsObject:tab]) | 968 if ([closingControllers_ containsObject:tab]) |
| 969 continue; | 969 continue; |
| 970 | 970 |
| 971 BOOL isPlaceholder = [[tab view] isEqual:placeholderTab_]; | 971 BOOL isPlaceholder = [[tab view] isEqual:placeholderTab_]; |
| 972 NSRect tabFrame = [[tab view] frame]; | 972 NSRect tabFrame = [[tab view] frame]; |
| 973 tabFrame.size.height = [[self class] defaultTabHeight] + 1; | 973 tabFrame.size.height = [[self class] defaultTabHeight]; |
| 974 tabFrame.origin.y = 0; | 974 tabFrame.origin.y = 0; |
| 975 tabFrame.origin.x = offset; | 975 tabFrame.origin.x = offset; |
| 976 | 976 |
| 977 // If the tab is hidden, we consider it a new tab. We make it visible | 977 // If the tab is hidden, we consider it a new tab. We make it visible |
| 978 // and animate it in. | 978 // and animate it in. |
| 979 BOOL newTab = [[tab view] isHidden]; | 979 BOOL newTab = [[tab view] isHidden]; |
| 980 if (newTab) | 980 if (newTab) |
| 981 [[tab view] setHidden:NO]; | 981 [[tab view] setHidden:NO]; |
| 982 | 982 |
| 983 if (isPlaceholder) { | 983 if (isPlaceholder) { |
| (...skipping 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2136 NSView* GetSheetParentViewForWebContents(WebContents* web_contents) { | 2136 NSView* GetSheetParentViewForWebContents(WebContents* web_contents) { |
| 2137 // View hierarchy of the contents view: | 2137 // View hierarchy of the contents view: |
| 2138 // NSView -- switchView, same for all tabs | 2138 // NSView -- switchView, same for all tabs |
| 2139 // +- NSView -- TabContentsController's view | 2139 // +- NSView -- TabContentsController's view |
| 2140 // +- TabContentsViewCocoa | 2140 // +- TabContentsViewCocoa |
| 2141 // | 2141 // |
| 2142 // Changing it? Do not forget to modify | 2142 // Changing it? Do not forget to modify |
| 2143 // -[TabStripController swapInTabAtIndex:] too. | 2143 // -[TabStripController swapInTabAtIndex:] too. |
| 2144 return [web_contents->GetNativeView() superview]; | 2144 return [web_contents->GetNativeView() superview]; |
| 2145 } | 2145 } |
| OLD | NEW |