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

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

Issue 10870094: Constrained window sheet controller (test patch) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rename Created 8 years, 4 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
Index: chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm
diff --git a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm
index 9a0a1c9a836f3449b0db2f641fbbdf3ded867feb..d05fb701e230862bea4da24fa0e5b23e9c9bb0c4 100644
--- a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm
+++ b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm
@@ -30,6 +30,7 @@
#include "chrome/browser/ui/browser_navigator.h"
#include "chrome/browser/ui/browser_tabstrip.h"
#import "chrome/browser/ui/cocoa/browser_window_controller.h"
+#import "chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_controller.h"
#import "chrome/browser/ui/cocoa/constrained_window_mac.h"
#include "chrome/browser/ui/cocoa/drag_util.h"
#import "chrome/browser/ui/cocoa/image_button_cell.h"
@@ -551,15 +552,20 @@ private:
[controller ensureContentsVisible];
// Tell per-tab sheet manager about currently selected tab.
- if (sheetController_.get()) {
+ if (sheetController_.get())
[sheetController_ setActiveView:newView];
- }
+
+ NSWindow* parentWindow = [switchView_ window];
+ ConstrainedWindowSheetController* sheetController =
+ [ConstrainedWindowSheetController
+ controllerForParentWindow:parentWindow];
+ [sheetController parentViewDidBecomeActive:newView];
// Make sure the new tabs's sheets are visible (necessary when a background
// tab opened a sheet while it was in the background and now becomes active).
TabContents* newTab = tabStripModel_->GetTabContentsAt(modelIndex);
DCHECK(newTab);
- if (newTab) {
+ if (newTab && ![sheetController sheetCount]) {
ConstrainedWindowTabHelper::ConstrainedWindowList::iterator it, end;
end = newTab->constrained_window_tab_helper()->constrained_window_end();
NSWindowController* controller = [[newView window] windowController];
@@ -2076,55 +2082,4 @@ private:
tabStripModel_->ActivateTabAt(index, false /* not a user gesture */);
}
-- (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.
-
- // View hierarchy of the contents view:
- // NSView -- switchView, same for all tabs
- // +- NSView -- TabContentsController's view
- // +- TabContentsViewCocoa
- // Changing it? Do not forget to modify removeConstrainedWindow too.
- // We use the TabContentsController's view in |swapInTabAtIndex|, so we have
- // to pass it to the sheet controller here.
- NSView* tabContentsView =
- [window->owner()->web_contents()->GetNativeView() 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
- // between windows, e.g. no tearing off of tabs.
- NSInteger modelIndex = [self modelIndexForContentsView:tabContentsView];
- NSInteger index = [self indexFromModelIndex:modelIndex];
- BrowserWindowController* controller =
- (BrowserWindowController*)[[switchView_ window] windowController];
- DCHECK(controller != nil);
- DCHECK(index >= 0);
- if (index >= 0) {
- [controller setTab:[self viewAtIndex:index] isDraggable:NO];
- }
-}
-
-- (void)removeConstrainedWindow:(ConstrainedWindowMac*)window {
- NSView* tabContentsView =
- [window->owner()->web_contents()->GetNativeView() superview];
-
- // TODO(avi, thakis): GTMWindowSheetController has no api to move tabsheets
- // between windows. Until then, we have to prevent having to move a tabsheet
- // between windows, e.g. no tearing off of tabs.
- NSInteger modelIndex = [self modelIndexForContentsView:tabContentsView];
- if (modelIndex < 0) {
- // This can happen during shutdown where the tab contents view has already
- // removed itself.
- return;
- }
- NSInteger index = [self indexFromModelIndex:modelIndex];
- BrowserWindowController* controller =
- (BrowserWindowController*)[[switchView_ window] windowController];
- DCHECK(index >= 0);
- if (index >= 0) {
- [controller setTab:[self viewAtIndex:index] isDraggable:YES];
- }
-}
-
@end
« no previous file with comments | « chrome/browser/ui/cocoa/tabs/tab_strip_controller.h ('k') | chrome/browser/ui/cocoa/tabs/tab_window_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698