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

Side by Side Diff: chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm

Issue 2502483002: Fixed dragging a folder from bookmark manager to open all elements in new tabs (Closed)
Patch Set: Removed unnecessary GURL construction and do anti XSS check for bookmark dragging 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 unified diff | Download patch
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/tabs/tab_strip_controller.h" 5 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h"
6 6
7 #import <QuartzCore/QuartzCore.h> 7 #import <QuartzCore/QuartzCore.h>
8 8
9 #include <cmath> 9 #include <cmath>
10 #include <limits> 10 #include <limits>
(...skipping 2088 matching lines...) Expand 10 before | Expand all | Expand 10 after
2099 2099
2100 // (URLDropTargetController protocol) 2100 // (URLDropTargetController protocol)
2101 - (void)dropURLs:(NSArray*)urls inView:(NSView*)view at:(NSPoint)point { 2101 - (void)dropURLs:(NSArray*)urls inView:(NSView*)view at:(NSPoint)point {
2102 DCHECK_EQ(view, tabStripView_.get()); 2102 DCHECK_EQ(view, tabStripView_.get());
2103 2103
2104 if ([urls count] < 1) { 2104 if ([urls count] < 1) {
2105 NOTREACHED(); 2105 NOTREACHED();
2106 return; 2106 return;
2107 } 2107 }
2108 2108
2109 //TODO(viettrungluu): dropping multiple URLs. 2109 for (id urlString in [urls reverseObjectEnumerator]) {
2110 if ([urls count] > 1) 2110 GURL url = url_formatter::FixupURL(base::SysNSStringToUTF8(urlString),
2111 NOTIMPLEMENTED(); 2111 std::string());
2112 2112
2113 // Get the first URL and fix it up. 2113 // If the URL isn't valid, don't bother.
2114 GURL url(GURL(url_formatter::FixupURL( 2114 if (!url.is_valid())
2115 base::SysNSStringToUTF8([urls objectAtIndex:0]), std::string()))); 2115 continue;
2116 2116
2117 // If the URL isn't valid, don't bother. 2117 [self openURL:&url inView:view at:point];
2118 if (!url.is_valid()) 2118 }
2119 return;
2120 2119
2121 [self openURL:&url inView:view at:point]; 2120 tabStripModel_->ActivateTabAt(tabStripModel_->count() - 1, true);
erikchen 2016/11/14 18:22:53 is this necessary? This assumes that the last tab
shahriar 2016/11/15 02:51:12 Right, I fixed it to select the last tab inserted.
2122 } 2121 }
2123 2122
2124 // (URLDropTargetController protocol) 2123 // (URLDropTargetController protocol)
2125 - (void)dropText:(NSString*)text inView:(NSView*)view at:(NSPoint)point { 2124 - (void)dropText:(NSString*)text inView:(NSView*)view at:(NSPoint)point {
2126 DCHECK_EQ(view, tabStripView_.get()); 2125 DCHECK_EQ(view, tabStripView_.get());
2127 2126
2128 // If the input is plain text, classify the input and make the URL. 2127 // If the input is plain text, classify the input and make the URL.
2129 AutocompleteMatch match; 2128 AutocompleteMatch match;
2130 AutocompleteClassifierFactory::GetForProfile(browser_->profile())->Classify( 2129 AutocompleteClassifierFactory::GetForProfile(browser_->profile())->Classify(
2131 base::SysNSStringToUTF16(text), false, false, 2130 base::SysNSStringToUTF16(text), false, false,
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
2338 for (int i = 0; i < tabStripModel_->count(); i++) { 2337 for (int i = 0; i < tabStripModel_->count(); i++) {
2339 [self updateIconsForContents:tabStripModel_->GetWebContentsAt(i) atIndex:i]; 2338 [self updateIconsForContents:tabStripModel_->GetWebContentsAt(i) atIndex:i];
2340 } 2339 }
2341 } 2340 }
2342 2341
2343 - (void)setVisualEffectsDisabledForFullscreen:(BOOL)fullscreen { 2342 - (void)setVisualEffectsDisabledForFullscreen:(BOOL)fullscreen {
2344 [tabStripView_ setVisualEffectsDisabledForFullscreen:fullscreen]; 2343 [tabStripView_ setVisualEffectsDisabledForFullscreen:fullscreen];
2345 } 2344 }
2346 2345
2347 @end 2346 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698