Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Side by Side Diff: chrome/browser/cocoa/tab_strip_controller.mm

Issue 459008: Mac: the return of the tab-modal-sheets patch. (Closed)
Patch Set: Merged ToT. Must ... commit ... soon. Created 11 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/cocoa/shell_dialogs_mac.mm ('k') | chrome/browser/download/download_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 NSArray* subviews = [switchView_ subviews]; 379 NSArray* subviews = [switchView_ subviews];
380 if ([subviews count]) { 380 if ([subviews count]) {
381 NSView* oldView = [subviews objectAtIndex:0]; 381 NSView* oldView = [subviews objectAtIndex:0];
382 [switchView_ replaceSubview:oldView with:newView]; 382 [switchView_ replaceSubview:oldView with:newView];
383 } else { 383 } else {
384 [switchView_ addSubview:newView]; 384 [switchView_ addSubview:newView];
385 } 385 }
386 386
387 // Make sure the new tabs's sheets are visible (necessary when a background 387 // Make sure the new tabs's sheets are visible (necessary when a background
388 // tab opened a sheet while it was in the background and now becomes active). 388 // tab opened a sheet while it was in the background and now becomes active).
389 // TODO(viettrungluu): Directly iterating over the |TabContents|'s
390 // (essentially internal, private) list isn't great -- I'd like to get rid of
391 // this and somehow move it into |TabContents| itself (or provide a cleaner
392 // interface).
389 TabContents* newTab = tabStripModel_->GetTabContentsAt(modelIndex); 393 TabContents* newTab = tabStripModel_->GetTabContentsAt(modelIndex);
390 DCHECK(newTab); 394 DCHECK(newTab);
391 if (newTab) { 395 if (newTab) {
392 TabContents::ConstrainedWindowList::iterator it, end; 396 TabContents::ConstrainedWindowList::iterator it, end;
393 it = newTab->constrained_window_begin(); 397 it = newTab->constrained_window_begin();
394 end = newTab->constrained_window_end(); 398 end = newTab->constrained_window_end();
395 399
396 // GTMWindowSheetController supports only one sheet at a time. 400 // GTMWindowSheetController supports only one sheet at a time.
397 if (it != end) { 401 if (it != end) {
398 NSWindowController* controller = [[newView window] windowController]; 402 NSWindowController* controller = [[newView window] windowController];
(...skipping 1227 matching lines...) Expand 10 before | Expand all | Expand 10 after
1626 1630
1627 std::deque<ConstrainedWindowMac*>& windows = constrainedWindows_[tab]; 1631 std::deque<ConstrainedWindowMac*>& windows = constrainedWindows_[tab];
1628 std::deque<ConstrainedWindowMac*>::iterator it = 1632 std::deque<ConstrainedWindowMac*>::iterator it =
1629 find(windows.begin(), windows.end(), window); 1633 find(windows.begin(), windows.end(), window);
1630 if (it == windows.end()) 1634 if (it == windows.end())
1631 constrainedWindows_[tab].push_back(window); 1635 constrainedWindows_[tab].push_back(window);
1632 1636
1633 if (constrainedWindows_[tab].size() == 1) { 1637 if (constrainedWindows_[tab].size() == 1) {
1634 [controller setTab:tab isDraggable:NO]; 1638 [controller setTab:tab isDraggable:NO];
1635 window->SetVisible(); 1639 window->SetVisible();
1636 window->delegate()->RunSheet([self sheetController], tabContentsView); 1640
1641 SEL frameSelector = nil;
1642 SEL positionSelector = nil;
1643 // TODO(viettrungluu): I need to provide appropriate selectors and stuff.
1644 #if 0
1645 if (window->delegate()->GetModalityLevel() >=
1646 ConstrainedWindow::kModalForTab) {
1647 frameSelector = @selector(frameWithBars);
1648 positionSelector = @selector(positionSheetBelowToolbar:usingRect:);
1649 }
1650 #endif
1651 window->delegate()->RunSheet([self sheetController],
1652 tabContentsView,
1653 frameSelector,
1654 positionSelector);
1637 return YES; 1655 return YES;
1638 } 1656 }
1639 } 1657 }
1640 return NO; 1658 return NO;
1641 } 1659 }
1642 1660
1643 - (void)removeConstrainedWindow:(ConstrainedWindowMac*)window { 1661 - (void)removeConstrainedWindow:(ConstrainedWindowMac*)window {
1644 NSView* tabContentsView = 1662 NSView* tabContentsView =
1645 [[window->owner()->GetNativeView() superview] superview]; 1663 [[window->owner()->GetNativeView() superview] superview];
1646 1664
(...skipping 25 matching lines...) Expand all
1672 // Show next sheet 1690 // Show next sheet
1673 NSWindowController* controller = [[tab window] windowController]; 1691 NSWindowController* controller = [[tab window] windowController];
1674 DCHECK([controller isKindOfClass:[BrowserWindowController class]]); 1692 DCHECK([controller isKindOfClass:[BrowserWindowController class]]);
1675 windows.front()->Realize( 1693 windows.front()->Realize(
1676 static_cast<BrowserWindowController*>(controller)); 1694 static_cast<BrowserWindowController*>(controller));
1677 } 1695 }
1678 } 1696 }
1679 } 1697 }
1680 1698
1681 @end 1699 @end
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/shell_dialogs_mac.mm ('k') | chrome/browser/download/download_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698