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

Side by Side 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 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 // TODO(viettrungluu): dropping multiple URLs? 1033 for (id urlString in urls) {
1034 if ([urls count] > 1) 1034 // Refactor this code.
1035 NOTIMPLEMENTED(); 1035 // https://crbug.com/665261.
1036 GURL url = url_formatter::FixupURL(base::SysNSStringToUTF8(urlString),
1037 std::string());
1036 1038
1037 // Get the first URL and fix it up. 1039 // If the URL isn't valid, don't bother.
1038 GURL url(url_formatter::FixupURL( 1040 if (!url.is_valid())
1039 base::SysNSStringToUTF8([urls objectAtIndex:0]), std::string())); 1041 continue;
1040 1042
1041 // Security: Sanitize text to prevent self-XSS. 1043 // Security: Sanitize text to prevent self-XSS.
1042 if (url.SchemeIs(url::kJavaScriptScheme)) { 1044 if (url.SchemeIs(url::kJavaScriptScheme))
1043 browser_->window()->GetLocationBar()->GetOmniboxView()->SetUserText( 1045 continue;
1044 OmniboxView::StripJavascriptSchemas(base::UTF8ToUTF16(url.spec()))); 1046
1045 return; 1047 OpenURLParams params(url, Referrer(),
1048 WindowOpenDisposition::NEW_FOREGROUND_TAB,
1049 ui::PAGE_TRANSITION_TYPED, false);
1050 browser_->tab_strip_model()->GetActiveWebContents()->OpenURL(params);
1046 } 1051 }
1047
1048 OpenURLParams params(url, Referrer(), WindowOpenDisposition::CURRENT_TAB,
1049 ui::PAGE_TRANSITION_TYPED, false);
1050 browser_->tab_strip_model()->GetActiveWebContents()->OpenURL(params);
1051 } 1052 }
1052 1053
1053 // (URLDropTargetController protocol) 1054 // (URLDropTargetController protocol)
1054 - (void)dropText:(NSString*)text inView:(NSView*)view at:(NSPoint)point { 1055 - (void)dropText:(NSString*)text inView:(NSView*)view at:(NSPoint)point {
1055 // TODO(viettrungluu): This code is more or less copied from the code in 1056 // TODO(viettrungluu): This code is more or less copied from the code in
1056 // |TabStripController|. I'll refactor this soon to make it common and expand 1057 // |TabStripController|. I'll refactor this soon to make it common and expand
1057 // its capabilities (e.g., allow text DnD). 1058 // its capabilities (e.g., allow text DnD).
1058 1059
1059 // If the input is plain text, classify the input and make the URL. 1060 // If the input is plain text, classify the input and make the URL.
1060 AutocompleteMatch match; 1061 AutocompleteMatch match;
(...skipping 20 matching lines...) Expand all
1081 - (void)hideDropURLsIndicatorInView:(NSView*)view { 1082 - (void)hideDropURLsIndicatorInView:(NSView*)view {
1082 // Do nothing. 1083 // Do nothing.
1083 } 1084 }
1084 1085
1085 // (URLDropTargetController protocol) 1086 // (URLDropTargetController protocol)
1086 - (BOOL)isUnsupportedDropData:(id<NSDraggingInfo>)info { 1087 - (BOOL)isUnsupportedDropData:(id<NSDraggingInfo>)info {
1087 return drag_util::IsUnsupportedDropData(profile_, info); 1088 return drag_util::IsUnsupportedDropData(profile_, info);
1088 } 1089 }
1089 1090
1090 @end 1091 @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