summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/cocoa')
-rw-r--r--chrome/browser/cocoa/browser_window_controller.mm15
-rw-r--r--chrome/browser/cocoa/tab_view.mm6
-rw-r--r--chrome/browser/cocoa/tab_window_controller.h4
-rw-r--r--chrome/browser/cocoa/tab_window_controller.mm6
4 files changed, 30 insertions, 1 deletions
diff --git a/chrome/browser/cocoa/browser_window_controller.mm b/chrome/browser/cocoa/browser_window_controller.mm
index 2cb822b..a138905 100644
--- a/chrome/browser/cocoa/browser_window_controller.mm
+++ b/chrome/browser/cocoa/browser_window_controller.mm
@@ -364,6 +364,21 @@ willPositionSheet:(NSWindow *)sheet
return [tabStripController_ selectedTabGrowBoxRect];
}
+// Accept tabs from a BrowserWindowController with the same Profile.
+- (BOOL)canReceiveFrom:(TabWindowController*)source {
+ if (![source isKindOfClass:[BrowserWindowController class]]) {
+ return NO;
+ }
+
+ BrowserWindowController* realSource =
+ static_cast<BrowserWindowController*>(source);
+ if (browser_->profile() != realSource->browser_->profile()) {
+ return NO;
+ }
+
+ return YES;
+}
+
// Move a given tab view to the location of the current placeholder. If there is
// no placeholder, it will go at the end. |controller| is the window controller
// of a tab being dropped from a different window. It will be nil if the drag is
diff --git a/chrome/browser/cocoa/tab_view.mm b/chrome/browser/cocoa/tab_view.mm
index fe45b592..ee655f2 100644
--- a/chrome/browser/cocoa/tab_view.mm
+++ b/chrome/browser/cocoa/tab_view.mm
@@ -182,7 +182,11 @@ static const double kDragStartDistance = 3.0;
if (![window isVisible]) continue;
NSWindowController *controller = [window windowController];
if ([controller isKindOfClass:[TabWindowController class]]) {
- [targets addObject:controller];
+ TabWindowController* realController =
+ static_cast<TabWindowController*>(controller);
+ if ([realController canReceiveFrom:sourceController_]) {
+ [targets addObject:controller];
+ }
}
}
}
diff --git a/chrome/browser/cocoa/tab_window_controller.h b/chrome/browser/cocoa/tab_window_controller.h
index 313887d..4f97173 100644
--- a/chrome/browser/cocoa/tab_window_controller.h
+++ b/chrome/browser/cocoa/tab_window_controller.h
@@ -62,6 +62,10 @@
// Removes the placeholder installed by |-insertPlaceholderForTab:atLocation:|.
- (void)removePlaceholder;
+// Called to check if the receiver can receive dragged tabs from
+// source. Return YES if so. The default implementation returns NO.
+- (BOOL)canReceiveFrom:(TabWindowController*)source;
+
// Move a given tab view to the location of the current placeholder. If there is
// no placeholder, it will go at the end. |controller| is the window controller
// of a tab being dropped from a different window. It will be nil if the drag is
diff --git a/chrome/browser/cocoa/tab_window_controller.mm b/chrome/browser/cocoa/tab_window_controller.mm
index 8d808a4..12fc4a5 100644
--- a/chrome/browser/cocoa/tab_window_controller.mm
+++ b/chrome/browser/cocoa/tab_window_controller.mm
@@ -100,6 +100,12 @@
return overlayWindow_;
}
+- (BOOL)canReceiveFrom:(TabWindowController*)source {
+ // subclass must implement
+ NOTIMPLEMENTED();
+ return NO;
+}
+
- (void)moveTabView:(NSView*)view
fromController:(TabWindowController*)dragController {
NOTIMPLEMENTED();