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

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

Issue 2572363002: Revert of Fixed dragging a folder from bookmark manager to open all elements in new tabs (Closed)
Patch Set: Created 4 years 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 | « no previous file | chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 e7bad4b7bd4785c9408900f4007cd2fd493f93bb..46ee02b7bd2c0a85e26e76dfee4ce049c59e82e4 100644
--- a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm
+++ b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm
@@ -179,8 +179,7 @@
- (void)setTabTrackingAreasEnabled:(BOOL)enabled;
- (void)droppingURLsAt:(NSPoint)point
givesIndex:(NSInteger*)index
- disposition:(WindowOpenDisposition*)disposition
- activateTab:(BOOL)activateTab;
+ disposition:(WindowOpenDisposition*)disposition;
- (void)setNewTabButtonHoverState:(BOOL)showHover;
- (void)themeDidChangeNotification:(NSNotification*)notification;
- (BOOL)doesAnyOtherWebContents:(content::WebContents*)selected
@@ -2039,8 +2038,7 @@
// to the left, it inserts to the left, and similarly for the right.
- (void)droppingURLsAt:(NSPoint)point
givesIndex:(NSInteger*)index
- disposition:(WindowOpenDisposition*)disposition
- activateTab:(BOOL)activateTab {
+ disposition:(WindowOpenDisposition*)disposition {
// Proportion of the tab which is considered the "middle" (and causes things
// to drop on that tab).
const double kMiddleProportion = 0.5;
@@ -2071,11 +2069,7 @@
// Drop in a new tab before tab |i|?
if (isRTL ? point.x > rightEdge : point.x < leftEdge) {
*index = i;
- if (activateTab) {
- *disposition = WindowOpenDisposition::NEW_FOREGROUND_TAB;
- } else {
- *disposition = WindowOpenDisposition::NEW_BACKGROUND_TAB;
- }
+ *disposition = WindowOpenDisposition::NEW_FOREGROUND_TAB;
return;
}
@@ -2093,17 +2087,10 @@
// If we've made it here, we want to append a new tab to the end.
*index = -1;
- if (activateTab) {
- *disposition = WindowOpenDisposition::NEW_FOREGROUND_TAB;
- } else {
- *disposition = WindowOpenDisposition::NEW_BACKGROUND_TAB;
- }
-}
-
-- (void)openURL:(GURL*)url
- inView:(NSView*)view
- at:(NSPoint)point
- activateTab:(BOOL)activateTab {
+ *disposition = WindowOpenDisposition::NEW_FOREGROUND_TAB;
+}
+
+- (void)openURL:(GURL*)url inView:(NSView*)view at:(NSPoint)point {
// Security: Block JavaScript to prevent self-XSS.
if (url->SchemeIs(url::kJavaScriptScheme))
return;
@@ -2113,13 +2100,11 @@
WindowOpenDisposition disposition;
[self droppingURLsAt:point
givesIndex:&index
- disposition:&disposition
- activateTab:activateTab];
+ disposition:&disposition];
// Either insert a new tab or open in a current tab.
switch (disposition) {
- case WindowOpenDisposition::NEW_FOREGROUND_TAB:
- case WindowOpenDisposition::NEW_BACKGROUND_TAB: {
+ case WindowOpenDisposition::NEW_FOREGROUND_TAB: {
content::RecordAction(UserMetricsAction("Tab_DropURLBetweenTabs"));
chrome::NavigateParams params(browser_, *url,
ui::PAGE_TRANSITION_TYPED);
@@ -2152,22 +2137,19 @@
return;
}
- for (NSInteger index = [urls count] - 1; index >= 0; index--) {
- // Refactor this code.
- // https://crbug.com/665261.
- GURL url = url_formatter::FixupURL(
- base::SysNSStringToUTF8([urls objectAtIndex:index]), std::string());
-
- // If the URL isn't valid, don't bother.
- if (!url.is_valid())
- continue;
-
- if (index == static_cast<NSInteger>([urls count]) - 1) {
- [self openURL:&url inView:view at:point activateTab:YES];
- } else {
- [self openURL:&url inView:view at:point activateTab:NO];
- }
- }
+ //TODO(viettrungluu): dropping multiple URLs.
+ if ([urls count] > 1)
+ NOTIMPLEMENTED();
+
+ // Get the first URL and fix it up.
+ GURL url(GURL(url_formatter::FixupURL(
+ base::SysNSStringToUTF8([urls objectAtIndex:0]), std::string())));
+
+ // If the URL isn't valid, don't bother.
+ if (!url.is_valid())
+ return;
+
+ [self openURL:&url inView:view at:point];
}
// (URLDropTargetController protocol)
@@ -2181,7 +2163,7 @@
metrics::OmniboxEventProto::BLANK, &match, NULL);
GURL url(match.destination_url);
- [self openURL:&url inView:view at:point activateTab:YES];
+ [self openURL:&url inView:view at:point];
}
// (URLDropTargetController protocol)
@@ -2196,8 +2178,7 @@
WindowOpenDisposition disposition;
[self droppingURLsAt:point
givesIndex:&index
- disposition:&disposition
- activateTab:YES];
+ disposition:&disposition];
NSPoint arrowPos = NSMakePoint(0, arrowBaseY);
if (index == -1) {
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698