From 3409a076f506e4d7e80f7d79424ca27741ceeb19 Mon Sep 17 00:00:00 2001 From: "pinkerton@chromium.org" Date: Thu, 9 Apr 2009 20:49:26 +0000 Subject: Re-order the steps used to create the new browser window on a tab drag in order to make sure the TabContents' delegate doesn't get clobbered. Fix the define of a file that had been moved a while ago. Review URL: http://codereview.chromium.org/67007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13455 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/cocoa/browser_window_controller.h | 6 +++--- chrome/browser/cocoa/browser_window_controller.mm | 10 ++++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/chrome/browser/cocoa/browser_window_controller.h b/chrome/browser/cocoa/browser_window_controller.h index 04deaf58..df77819 100644 --- a/chrome/browser/cocoa/browser_window_controller.h +++ b/chrome/browser/cocoa/browser_window_controller.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_BROWSER_WINDOW_CONTROLLER_H_ -#define CHROME_BROWSER_BROWSER_WINDOW_CONTROLLER_H_ +#ifndef CHROME_BROWSER_COCOA_BROWSER_WINDOW_CONTROLLER_H_ +#define CHROME_BROWSER_COCOA_BROWSER_WINDOW_CONTROLLER_H_ // A class acting as the Objective-C controller for the Browser object. Handles // interactions between Cocoa and the cross-platform code. @@ -77,4 +77,4 @@ class TabStripModelObserverBridge; @end -#endif // CHROME_BROWSER_BROWSER_WINDOW_CONTROLLER_H_ +#endif // CHROME_BROWSER_COCOA_BROWSER_WINDOW_CONTROLLER_H_ diff --git a/chrome/browser/cocoa/browser_window_controller.mm b/chrome/browser/cocoa/browser_window_controller.mm index ac78712..fc1e0ec 100644 --- a/chrome/browser/cocoa/browser_window_controller.mm +++ b/chrome/browser/cocoa/browser_window_controller.mm @@ -270,6 +270,12 @@ gfx::Rect browserRect(windowRect.origin.x, windowRect.origin.y, windowRect.size.width, windowRect.size.height); + // Detach it from the source window, which just updates the model without + // deleting the tab contents. This needs to come before creating the new + // Browser because it clears the TabContents' delegate, which gets hooked + // up during creation of the new window. + browser_->tabstrip_model()->DetachTabContentsAt(index); + // Create the new window with a single tab in its model, the one being // dragged. DockInfo dockInfo; @@ -283,10 +289,6 @@ [newBrowser->window()->GetNativeHandle() delegate]; DCHECK(controller && [controller isKindOfClass:[TabWindowController class]]); - // Detach it from the source window, which just updates the model without - // deleting the tab contents. - browser_->tabstrip_model()->DetachTabContentsAt(index); - return controller; } -- cgit v1.1