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

Unified Diff: chrome/browser/cocoa/tab_strip_controller.mm

Issue 541056: Tab-modal dialog improvements:... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 11 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/cocoa/tab_strip_controller.h ('k') | chrome/browser/gtk/constrained_window_gtk.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/cocoa/tab_strip_controller.mm
===================================================================
--- chrome/browser/cocoa/tab_strip_controller.mm (revision 36364)
+++ chrome/browser/cocoa/tab_strip_controller.mm (working copy)
@@ -417,13 +417,11 @@
DCHECK(newTab);
if (newTab) {
TabContents::ConstrainedWindowList::iterator it, end;
- it = newTab->constrained_window_begin();
end = newTab->constrained_window_end();
+ NSWindowController* controller = [[newView window] windowController];
+ DCHECK([controller isKindOfClass:[BrowserWindowController class]]);
- // GTMWindowSheetController supports only one sheet at a time.
- if (it != end) {
- NSWindowController* controller = [[newView window] windowController];
- DCHECK([controller isKindOfClass:[BrowserWindowController class]]);
+ for (it = newTab->constrained_window_begin(); it != end; ++it) {
ConstrainedWindow* constrainedWindow = *it;
static_cast<ConstrainedWindowMac*>(constrainedWindow)->Realize(
static_cast<BrowserWindowController*>(controller));
@@ -1637,7 +1635,7 @@
if (modelIndex < 0)
return nil;
NSInteger index = [self indexFromModelIndex:modelIndex];
- if (index < 0 ||
+ if (index < 0 ||
index >= (NSInteger)[tabContentsArray_ count])
return nil;
return [tabContentsArray_ objectAtIndex:index];
@@ -1656,7 +1654,7 @@
tabStripModel_->SelectTabContentsAt(index, false /* not a user gesture */);
}
-- (BOOL)attachConstrainedWindow:(ConstrainedWindowMac*)window {
+- (void)attachConstrainedWindow:(ConstrainedWindowMac*)window {
// TODO(thakis, avi): Figure out how to make this work when tabs are dragged
// out or if fullscreen mode is toggled.
@@ -1669,6 +1667,7 @@
// to pass it to the sheet controller here.
NSView* tabContentsView =
[[window->owner()->GetNativeView() superview] superview];
+ window->delegate()->RunSheet([self sheetController], tabContentsView);
// TODO(avi, thakis): GTMWindowSheetController has no api to move tabsheets
// between windows. Until then, we have to prevent having to move a tabsheet
@@ -1680,23 +1679,8 @@
DCHECK(controller != nil);
DCHECK(index >= 0);
if (index >= 0) {
- NSView* tab = [self viewAtIndex:index];
- [controller setTab:tab isDraggable:NO];
-
- std::deque<ConstrainedWindowMac*>& windows = constrainedWindows_[tab];
- std::deque<ConstrainedWindowMac*>::iterator it =
- find(windows.begin(), windows.end(), window);
- if (it == windows.end())
- constrainedWindows_[tab].push_back(window);
-
- if (constrainedWindows_[tab].size() == 1) {
- [controller setTab:tab isDraggable:NO];
- window->SetVisible();
- window->delegate()->RunSheet([self sheetController], tabContentsView);
- return YES;
- }
+ [controller setTab:[self viewAtIndex:index] isDraggable:NO];
}
- return NO;
}
- (void)removeConstrainedWindow:(ConstrainedWindowMac*)window {
@@ -1712,28 +1696,7 @@
(BrowserWindowController*)[[switchView_ window] windowController];
DCHECK(index >= 0);
if (index >= 0) {
- NSView* tab = [self viewAtIndex:index];
-
- std::deque<ConstrainedWindowMac*>& windows = constrainedWindows_[tab];
- std::deque<ConstrainedWindowMac*>::iterator it =
- find(windows.begin(), windows.end(), window);
- DCHECK(it != windows.end());
-
- bool removedVisibleSheet = it == windows.begin();
-
- if (it != windows.end())
- windows.erase(it);
-
- if (windows.size() == 0) {
- [controller setTab:tab isDraggable:YES];
- constrainedWindows_.erase(tab);
- } else if (removedVisibleSheet && tab == [self selectedTabView]) {
- // Show next sheet
- NSWindowController* controller = [[tab window] windowController];
- DCHECK([controller isKindOfClass:[BrowserWindowController class]]);
- windows.front()->Realize(
- static_cast<BrowserWindowController*>(controller));
- }
+ [controller setTab:[self viewAtIndex:index] isDraggable:YES];
}
}
« no previous file with comments | « chrome/browser/cocoa/tab_strip_controller.h ('k') | chrome/browser/gtk/constrained_window_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698