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

Unified Diff: chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm

Issue 2502483002: Fixed dragging a folder from bookmark manager to open all elements in new tabs (Closed)
Patch Set: Replace c-style cast with static_cast for drag/drop bookmarks over tab strip Created 4 years, 1 month 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 644cbeeb4d58b86a893f05c7d5022947608ddb5b..4d8f612a24e3ad1b8419946f89c5347dd0a9775a 100644
--- a/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm
+++ b/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm
@@ -1030,24 +1030,25 @@ class NotificationBridge : public AppMenuIconController::Delegate {
return;
}
- // 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;
+ 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);
}
-
- 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