| 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 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 | 574 |
| 575 | 575 |
| 576 // Returns the view at the given index, using the array of TabControllers to | 576 // Returns the view at the given index, using the array of TabControllers to |
| 577 // get the associated view. Returns nil if out of range. | 577 // get the associated view. Returns nil if out of range. |
| 578 - (NSView*)viewAtIndex:(NSUInteger)index { | 578 - (NSView*)viewAtIndex:(NSUInteger)index { |
| 579 if (index >= [tabArray_ count]) | 579 if (index >= [tabArray_ count]) |
| 580 return NULL; | 580 return NULL; |
| 581 return [[tabArray_ objectAtIndex:index] view]; | 581 return [[tabArray_ objectAtIndex:index] view]; |
| 582 } | 582 } |
| 583 | 583 |
| 584 - (NSUInteger)viewsCount { |
| 585 return [tabArray_ count]; |
| 586 } |
| 587 |
| 584 // Called when the user clicks a tab. Tell the model the selection has changed, | 588 // Called when the user clicks a tab. Tell the model the selection has changed, |
| 585 // which feeds back into us via a notification. | 589 // which feeds back into us via a notification. |
| 586 - (void)selectTab:(id)sender { | 590 - (void)selectTab:(id)sender { |
| 587 DCHECK([sender isKindOfClass:[NSView class]]); | 591 DCHECK([sender isKindOfClass:[NSView class]]); |
| 588 int index = [self modelIndexForTabView:sender]; | 592 int index = [self modelIndexForTabView:sender]; |
| 589 if (tabStripModel_->ContainsIndex(index)) | 593 if (tabStripModel_->ContainsIndex(index)) |
| 590 tabStripModel_->SelectTabContentsAt(index, true); | 594 tabStripModel_->SelectTabContentsAt(index, true); |
| 591 } | 595 } |
| 592 | 596 |
| 593 // Called when the user closes a tab. Asks the model to close the tab. |sender| | 597 // Called when the user closes a tab. Asks the model to close the tab. |sender| |
| (...skipping 1217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1811 return; | 1815 return; |
| 1812 | 1816 |
| 1813 TabContentsController* tabController = | 1817 TabContentsController* tabController = |
| 1814 [tabContentsArray_ objectAtIndex:index]; | 1818 [tabContentsArray_ objectAtIndex:index]; |
| 1815 TabContents* devtoolsContents = contents ? | 1819 TabContents* devtoolsContents = contents ? |
| 1816 DevToolsWindow::GetDevToolsContents(contents) : NULL; | 1820 DevToolsWindow::GetDevToolsContents(contents) : NULL; |
| 1817 [tabController showDevToolsContents:devtoolsContents]; | 1821 [tabController showDevToolsContents:devtoolsContents]; |
| 1818 } | 1822 } |
| 1819 | 1823 |
| 1820 @end | 1824 @end |
| OLD | NEW |