| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/cocoa/tab_strip_controller.h" | 5 #import "chrome/browser/cocoa/tab_strip_controller.h" |
| 6 | 6 |
| 7 #import <QuartzCore/QuartzCore.h> | 7 #import <QuartzCore/QuartzCore.h> |
| 8 | 8 |
| 9 #include <limits> | 9 #include <limits> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 646 // Returns YES if the specificed command should be enabled for the given | 646 // Returns YES if the specificed command should be enabled for the given |
| 647 // controller. | 647 // controller. |
| 648 - (BOOL)isCommandEnabled:(TabStripModel::ContextMenuCommand)command | 648 - (BOOL)isCommandEnabled:(TabStripModel::ContextMenuCommand)command |
| 649 forController:(TabController*)controller { | 649 forController:(TabController*)controller { |
| 650 int index = [self modelIndexForTabView:[controller view]]; | 650 int index = [self modelIndexForTabView:[controller view]]; |
| 651 if (!tabStripModel_->ContainsIndex(index)) | 651 if (!tabStripModel_->ContainsIndex(index)) |
| 652 return NO; | 652 return NO; |
| 653 return tabStripModel_->IsContextMenuCommandEnabled(index, command) ? YES : NO; | 653 return tabStripModel_->IsContextMenuCommandEnabled(index, command) ? YES : NO; |
| 654 } | 654 } |
| 655 | 655 |
| 656 // Returns the index of the tab controller. Returns -1 if not present. |
| 657 // Unlike modelIndexForTabView, this method does not care about whether the tab |
| 658 // is closing or not. |
| 659 - (NSInteger)indexForTabController:(TabController*)controller |
| 660 inTotal:(NSInteger*)total { |
| 661 if (total) |
| 662 *total = [tabArray_ count]; |
| 663 NSInteger index = 0; |
| 664 for (TabController* current in tabArray_.get()) { |
| 665 if (current == controller) |
| 666 return index; |
| 667 ++index; |
| 668 } |
| 669 return -1; |
| 670 } |
| 671 |
| 656 - (void)insertPlaceholderForTab:(TabView*)tab | 672 - (void)insertPlaceholderForTab:(TabView*)tab |
| 657 frame:(NSRect)frame | 673 frame:(NSRect)frame |
| 658 yStretchiness:(CGFloat)yStretchiness { | 674 yStretchiness:(CGFloat)yStretchiness { |
| 659 placeholderTab_ = tab; | 675 placeholderTab_ = tab; |
| 660 placeholderFrame_ = frame; | 676 placeholderFrame_ = frame; |
| 661 placeholderStretchiness_ = yStretchiness; | 677 placeholderStretchiness_ = yStretchiness; |
| 662 [self layoutTabsWithAnimation:initialLayoutComplete_ regenerateSubviews:NO]; | 678 [self layoutTabsWithAnimation:initialLayoutComplete_ regenerateSubviews:NO]; |
| 663 } | 679 } |
| 664 | 680 |
| 665 - (BOOL)isTabFullyVisible:(TabView*)tab { | 681 - (BOOL)isTabFullyVisible:(TabView*)tab { |
| (...skipping 1145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1811 return; | 1827 return; |
| 1812 | 1828 |
| 1813 TabContentsController* tabController = | 1829 TabContentsController* tabController = |
| 1814 [tabContentsArray_ objectAtIndex:index]; | 1830 [tabContentsArray_ objectAtIndex:index]; |
| 1815 TabContents* devtoolsContents = contents ? | 1831 TabContents* devtoolsContents = contents ? |
| 1816 DevToolsWindow::GetDevToolsContents(contents) : NULL; | 1832 DevToolsWindow::GetDevToolsContents(contents) : NULL; |
| 1817 [tabController showDevToolsContents:devtoolsContents]; | 1833 [tabController showDevToolsContents:devtoolsContents]; |
| 1818 } | 1834 } |
| 1819 | 1835 |
| 1820 @end | 1836 @end |
| OLD | NEW |