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

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: Fixed tab selection when drag/drop to TabStrip 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
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm » ('j') | 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/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 NSInteger numTabsInserted = 0;
2110 if ([urls count] > 1)
2111 NOTIMPLEMENTED();
2112 2110
2113 // Get the first URL and fix it up. 2111 for (id urlString in [urls reverseObjectEnumerator]) {
2114 GURL url(GURL(url_formatter::FixupURL( 2112 // Refactor this code.
2115 base::SysNSStringToUTF8([urls objectAtIndex:0]), std::string()))); 2113 // https://crbug.com/665261.
2114 GURL url = url_formatter::FixupURL(base::SysNSStringToUTF8(urlString),
2115 std::string());
2116 2116
2117 // If the URL isn't valid, don't bother. 2117 // If the URL isn't valid, don't bother.
2118 if (!url.is_valid()) 2118 if (!url.is_valid())
2119 return; 2119 continue;
2120 2120
2121 [self openURL:&url inView:view at:point]; 2121 [self openURL:&url inView:view at:point];
2122
2123 numTabsInserted++;
2124 }
2125
2126 // Now select the last tab inserted.
2127 tabStripModel_->ActivateTabAt(
erikchen 2016/11/18 18:26:21 There are better ways of doing this. You want to
shahriar 2016/11/21 02:52:38 Thank you very much for the explanation. I make ch
2128 tabStripModel_->active_index() + numTabsInserted - 1, true);
2122 } 2129 }
2123 2130
2124 // (URLDropTargetController protocol) 2131 // (URLDropTargetController protocol)
2125 - (void)dropText:(NSString*)text inView:(NSView*)view at:(NSPoint)point { 2132 - (void)dropText:(NSString*)text inView:(NSView*)view at:(NSPoint)point {
2126 DCHECK_EQ(view, tabStripView_.get()); 2133 DCHECK_EQ(view, tabStripView_.get());
2127 2134
2128 // If the input is plain text, classify the input and make the URL. 2135 // If the input is plain text, classify the input and make the URL.
2129 AutocompleteMatch match; 2136 AutocompleteMatch match;
2130 AutocompleteClassifierFactory::GetForProfile(browser_->profile())->Classify( 2137 AutocompleteClassifierFactory::GetForProfile(browser_->profile())->Classify(
2131 base::SysNSStringToUTF16(text), false, false, 2138 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++) { 2345 for (int i = 0; i < tabStripModel_->count(); i++) {
2339 [self updateIconsForContents:tabStripModel_->GetWebContentsAt(i) atIndex:i]; 2346 [self updateIconsForContents:tabStripModel_->GetWebContentsAt(i) atIndex:i];
2340 } 2347 }
2341 } 2348 }
2342 2349
2343 - (void)setVisualEffectsDisabledForFullscreen:(BOOL)fullscreen { 2350 - (void)setVisualEffectsDisabledForFullscreen:(BOOL)fullscreen {
2344 [tabStripView_ setVisualEffectsDisabledForFullscreen:fullscreen]; 2351 [tabStripView_ setVisualEffectsDisabledForFullscreen:fullscreen];
2345 } 2352 }
2346 2353
2347 @end 2354 @end
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698