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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" 5 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/mac/bundle_locations.h" 9 #include "base/mac/bundle_locations.h"
10 #include "base/mac/foundation_util.h" 10 #include "base/mac/foundation_util.h"
(...skipping 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after
1023 // (URLDropTargetController protocol) 1023 // (URLDropTargetController protocol)
1024 - (void)dropURLs:(NSArray*)urls inView:(NSView*)view at:(NSPoint)point { 1024 - (void)dropURLs:(NSArray*)urls inView:(NSView*)view at:(NSPoint)point {
1025 // TODO(viettrungluu): This code is more or less copied from the code in 1025 // TODO(viettrungluu): This code is more or less copied from the code in
1026 // |TabStripController|. I'll refactor this soon to make it common and expand 1026 // |TabStripController|. I'll refactor this soon to make it common and expand
1027 // its capabilities (e.g., allow text DnD). 1027 // its capabilities (e.g., allow text DnD).
1028 if ([urls count] < 1) { 1028 if ([urls count] < 1) {
1029 NOTREACHED(); 1029 NOTREACHED();
1030 return; 1030 return;
1031 } 1031 }
1032 1032
1033 for (id urlString in urls) { 1033 // TODO(viettrungluu): dropping multiple URLs?
1034 // Refactor this code. 1034 if ([urls count] > 1)
1035 // https://crbug.com/665261. 1035 NOTIMPLEMENTED();
1036 GURL url = url_formatter::FixupURL(base::SysNSStringToUTF8(urlString),
1037 std::string());
1038 1036
1039 // If the URL isn't valid, don't bother. 1037 // Get the first URL and fix it up.
1040 if (!url.is_valid()) 1038 GURL url(url_formatter::FixupURL(
1041 continue; 1039 base::SysNSStringToUTF8([urls objectAtIndex:0]), std::string()));
1042 1040
1043 // Security: Sanitize text to prevent self-XSS. 1041 // Security: Sanitize text to prevent self-XSS.
1044 if (url.SchemeIs(url::kJavaScriptScheme)) 1042 if (url.SchemeIs(url::kJavaScriptScheme)) {
1045 continue; 1043 browser_->window()->GetLocationBar()->GetOmniboxView()->SetUserText(
1044 OmniboxView::StripJavascriptSchemas(base::UTF8ToUTF16(url.spec())));
1045 return;
1046 }
1046 1047
1047 OpenURLParams params(url, Referrer(), 1048 OpenURLParams params(url, Referrer(), WindowOpenDisposition::CURRENT_TAB,
1048 WindowOpenDisposition::NEW_FOREGROUND_TAB, 1049 ui::PAGE_TRANSITION_TYPED, false);
1049 ui::PAGE_TRANSITION_TYPED, false); 1050 browser_->tab_strip_model()->GetActiveWebContents()->OpenURL(params);
1050 browser_->tab_strip_model()->GetActiveWebContents()->OpenURL(params);
1051 }
1052 } 1051 }
1053 1052
1054 // (URLDropTargetController protocol) 1053 // (URLDropTargetController protocol)
1055 - (void)dropText:(NSString*)text inView:(NSView*)view at:(NSPoint)point { 1054 - (void)dropText:(NSString*)text inView:(NSView*)view at:(NSPoint)point {
1056 // TODO(viettrungluu): This code is more or less copied from the code in 1055 // TODO(viettrungluu): This code is more or less copied from the code in
1057 // |TabStripController|. I'll refactor this soon to make it common and expand 1056 // |TabStripController|. I'll refactor this soon to make it common and expand
1058 // its capabilities (e.g., allow text DnD). 1057 // its capabilities (e.g., allow text DnD).
1059 1058
1060 // If the input is plain text, classify the input and make the URL. 1059 // If the input is plain text, classify the input and make the URL.
1061 AutocompleteMatch match; 1060 AutocompleteMatch match;
(...skipping 20 matching lines...) Expand all
1082 - (void)hideDropURLsIndicatorInView:(NSView*)view { 1081 - (void)hideDropURLsIndicatorInView:(NSView*)view {
1083 // Do nothing. 1082 // Do nothing.
1084 } 1083 }
1085 1084
1086 // (URLDropTargetController protocol) 1085 // (URLDropTargetController protocol)
1087 - (BOOL)isUnsupportedDropData:(id<NSDraggingInfo>)info { 1086 - (BOOL)isUnsupportedDropData:(id<NSDraggingInfo>)info {
1088 return drag_util::IsUnsupportedDropData(profile_, info); 1087 return drag_util::IsUnsupportedDropData(profile_, info);
1089 } 1088 }
1090 1089
1091 @end 1090 @end
OLDNEW
« 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