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/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 <limits> | 9 #include <limits> |
10 #include <string> | 10 #include <string> |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 // sidebar and tab content from resizing sidebar's content view. | 464 // sidebar and tab content from resizing sidebar's content view. |
465 // ensureContentsVisible (see below) sets content size and autoresizing | 465 // ensureContentsVisible (see below) sets content size and autoresizing |
466 // properties. | 466 // properties. |
467 [newView setFrame:[oldView frame]]; | 467 [newView setFrame:[oldView frame]]; |
468 [switchView_ replaceSubview:oldView with:newView]; | 468 [switchView_ replaceSubview:oldView with:newView]; |
469 } else { | 469 } else { |
470 [newView setFrame:[switchView_ bounds]]; | 470 [newView setFrame:[switchView_ bounds]]; |
471 [switchView_ addSubview:newView]; | 471 [switchView_ addSubview:newView]; |
472 } | 472 } |
473 | 473 |
| 474 TabContentsWrapper* newTab = tabStripModel_->GetTabContentsAt(modelIndex); |
| 475 DCHECK(newTab); |
| 476 |
474 // New content is in place, delegate should adjust itself accordingly. | 477 // New content is in place, delegate should adjust itself accordingly. |
475 [delegate_ onSelectTabWithContents:[controller tabContents]]; | 478 [delegate_ onSelectTab:newTab]; |
476 | 479 |
477 // It also restores content autoresizing properties. | 480 // It also restores content autoresizing properties. |
478 [controller ensureContentsVisible]; | 481 [controller ensureContentsVisible]; |
479 | 482 |
480 // Make sure the new tabs's sheets are visible (necessary when a background | 483 // Make sure the new tabs's sheets are visible (necessary when a background |
481 // tab opened a sheet while it was in the background and now becomes active). | 484 // tab opened a sheet while it was in the background and now becomes active). |
482 TabContentsWrapper* newTab = tabStripModel_->GetTabContentsAt(modelIndex); | |
483 DCHECK(newTab); | |
484 if (newTab) { | 485 if (newTab) { |
485 TabContents::ConstrainedWindowList::iterator it, end; | 486 TabContents::ConstrainedWindowList::iterator it, end; |
486 end = newTab->tab_contents()->constrained_window_end(); | 487 end = newTab->tab_contents()->constrained_window_end(); |
487 NSWindowController* controller = [[newView window] windowController]; | 488 NSWindowController* controller = [[newView window] windowController]; |
488 DCHECK([controller isKindOfClass:[BrowserWindowController class]]); | 489 DCHECK([controller isKindOfClass:[BrowserWindowController class]]); |
489 | 490 |
490 for (it = newTab->tab_contents()->constrained_window_begin(); | 491 for (it = newTab->tab_contents()->constrained_window_begin(); |
491 it != end; | 492 it != end; |
492 ++it) { | 493 ++it) { |
493 ConstrainedWindow* constrainedWindow = *it; | 494 ConstrainedWindow* constrainedWindow = *it; |
(...skipping 1400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1894 NSInteger index = [self indexFromModelIndex:modelIndex]; | 1895 NSInteger index = [self indexFromModelIndex:modelIndex]; |
1895 BrowserWindowController* controller = | 1896 BrowserWindowController* controller = |
1896 (BrowserWindowController*)[[switchView_ window] windowController]; | 1897 (BrowserWindowController*)[[switchView_ window] windowController]; |
1897 DCHECK(index >= 0); | 1898 DCHECK(index >= 0); |
1898 if (index >= 0) { | 1899 if (index >= 0) { |
1899 [controller setTab:[self viewAtIndex:index] isDraggable:YES]; | 1900 [controller setTab:[self viewAtIndex:index] isDraggable:YES]; |
1900 } | 1901 } |
1901 } | 1902 } |
1902 | 1903 |
1903 @end | 1904 @end |
OLD | NEW |