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

Side by Side Diff: chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm

Issue 2587763002: Fixed dragging a folder from bookmark manager to open all elements in new tabs (Closed)
Patch Set: Fixed the bug for opening first url in the bookmarks within the current tab 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 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after
1018 // (URLDropTargetController protocol) 1018 // (URLDropTargetController protocol)
1019 - (void)dropURLs:(NSArray*)urls inView:(NSView*)view at:(NSPoint)point { 1019 - (void)dropURLs:(NSArray*)urls inView:(NSView*)view at:(NSPoint)point {
1020 // TODO(viettrungluu): This code is more or less copied from the code in 1020 // TODO(viettrungluu): This code is more or less copied from the code in
1021 // |TabStripController|. I'll refactor this soon to make it common and expand 1021 // |TabStripController|. I'll refactor this soon to make it common and expand
1022 // its capabilities (e.g., allow text DnD). 1022 // its capabilities (e.g., allow text DnD).
1023 if ([urls count] < 1) { 1023 if ([urls count] < 1) {
1024 NOTREACHED(); 1024 NOTREACHED();
1025 return; 1025 return;
1026 } 1026 }
1027 1027
1028 // TODO(viettrungluu): dropping multiple URLs? 1028 for (NSUInteger index = 0; index < [urls count]; index++) {
1029 if ([urls count] > 1) 1029 // Refactor this code.
1030 NOTIMPLEMENTED(); 1030 // https://crbug.com/665261.
1031 GURL url = url_formatter::FixupURL(
1032 base::SysNSStringToUTF8([urls objectAtIndex:index]), std::string());
1031 1033
1032 // Get the first URL and fix it up. 1034 // If the URL isn't valid, don't bother.
1033 GURL url(url_formatter::FixupURL( 1035 if (!url.is_valid())
1034 base::SysNSStringToUTF8([urls objectAtIndex:0]), std::string())); 1036 continue;
1035 1037
1036 // Security: Sanitize text to prevent self-XSS. 1038 // Security: Sanitize text to prevent self-XSS.
1037 if (url.SchemeIs(url::kJavaScriptScheme)) { 1039 if (url.SchemeIs(url::kJavaScriptScheme))
1038 browser_->window()->GetLocationBar()->GetOmniboxView()->SetUserText( 1040 continue;
1039 OmniboxView::StripJavascriptSchemas(base::UTF8ToUTF16(url.spec()))); 1041
1040 return; 1042 WindowOpenDisposition disposition;
1043 if (index == 0)
1044 disposition = WindowOpenDisposition::CURRENT_TAB;
1045 else
1046 disposition = WindowOpenDisposition::NEW_FOREGROUND_TAB;
1047
1048 OpenURLParams params(url, Referrer(), disposition,
1049 ui::PAGE_TRANSITION_TYPED, false);
1050 browser_->tab_strip_model()->GetActiveWebContents()->OpenURL(params);
1041 } 1051 }
1042
1043 OpenURLParams params(url, Referrer(), WindowOpenDisposition::CURRENT_TAB,
1044 ui::PAGE_TRANSITION_TYPED, false);
1045 browser_->tab_strip_model()->GetActiveWebContents()->OpenURL(params);
1046 } 1052 }
1047 1053
1048 // (URLDropTargetController protocol) 1054 // (URLDropTargetController protocol)
1049 - (void)dropText:(NSString*)text inView:(NSView*)view at:(NSPoint)point { 1055 - (void)dropText:(NSString*)text inView:(NSView*)view at:(NSPoint)point {
1050 // 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
1051 // |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
1052 // its capabilities (e.g., allow text DnD). 1058 // its capabilities (e.g., allow text DnD).
1053 1059
1054 // 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.
1055 AutocompleteMatch match; 1061 AutocompleteMatch match;
(...skipping 20 matching lines...) Expand all
1076 - (void)hideDropURLsIndicatorInView:(NSView*)view { 1082 - (void)hideDropURLsIndicatorInView:(NSView*)view {
1077 // Do nothing. 1083 // Do nothing.
1078 } 1084 }
1079 1085
1080 // (URLDropTargetController protocol) 1086 // (URLDropTargetController protocol)
1081 - (BOOL)isUnsupportedDropData:(id<NSDraggingInfo>)info { 1087 - (BOOL)isUnsupportedDropData:(id<NSDraggingInfo>)info {
1082 return drag_util::IsUnsupportedDropData(profile_, info); 1088 return drag_util::IsUnsupportedDropData(profile_, info);
1083 } 1089 }
1084 1090
1085 @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