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

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

Issue 10871082: Constrained Windows Cocoa: Part 4 Refactor ConstrainedWindowSupport (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address review comments Created 8 years, 3 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..e3d90e01998e9f6ef13438ad88b129081c2cf0e8 100644
--- a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm
+++ b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm
@@ -2076,55 +2076,15 @@ 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.
+@end
+NSView* GetSheetParentViewForTabContents(TabContents* tab_contents) {
// 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];
- }
+ //
+ // Changing it? Do not forget to modify
+ // -[TabStripController swapInTabAtIndex:] too.
+ return [tab_contents->web_contents()->GetNativeView() superview];
}
-
-@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