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

Unified Diff: chrome/browser/ui/cocoa/toolbar/toolbar_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 | « chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm
diff --git a/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm b/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm
index 4d8f612a24e3ad1b8419946f89c5347dd0a9775a..644cbeeb4d58b86a893f05c7d5022947608ddb5b 100644
--- a/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm
+++ b/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm
@@ -1030,25 +1030,24 @@
return;
}
- for (id urlString in urls) {
- // Refactor this code.
- // https://crbug.com/665261.
- GURL url = url_formatter::FixupURL(base::SysNSStringToUTF8(urlString),
- std::string());
-
- // If the URL isn't valid, don't bother.
- if (!url.is_valid())
- continue;
-
- // Security: Sanitize text to prevent self-XSS.
- if (url.SchemeIs(url::kJavaScriptScheme))
- continue;
-
- OpenURLParams params(url, Referrer(),
- WindowOpenDisposition::NEW_FOREGROUND_TAB,
- ui::PAGE_TRANSITION_TYPED, false);
- browser_->tab_strip_model()->GetActiveWebContents()->OpenURL(params);
- }
+ // TODO(viettrungluu): dropping multiple URLs?
+ if ([urls count] > 1)
+ NOTIMPLEMENTED();
+
+ // Get the first URL and fix it up.
+ GURL url(url_formatter::FixupURL(
+ base::SysNSStringToUTF8([urls objectAtIndex:0]), std::string()));
+
+ // Security: Sanitize text to prevent self-XSS.
+ if (url.SchemeIs(url::kJavaScriptScheme)) {
+ browser_->window()->GetLocationBar()->GetOmniboxView()->SetUserText(
+ OmniboxView::StripJavascriptSchemas(base::UTF8ToUTF16(url.spec())));
+ return;
+ }
+
+ OpenURLParams params(url, Referrer(), WindowOpenDisposition::CURRENT_TAB,
+ ui::PAGE_TRANSITION_TYPED, false);
+ browser_->tab_strip_model()->GetActiveWebContents()->OpenURL(params);
}
// (URLDropTargetController protocol)
« no previous file with comments | « chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698