OLD | NEW |
---|---|
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 Loading... | |
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(GURL(url_formatter::FixupURL(base::SysNSStringToUTF8(urlString), |
2111 NOTIMPLEMENTED(); | 2111 std::string()))); |
2112 | 2112 |
Avi (use Gerrit)
2016/11/13 22:55:55
FixupURL returns a GURL. That original code makes
shahriar
2016/11/13 23:40:34
Done.
| |
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); |
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 Loading... | |
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 |
OLD | NEW |