| 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/location_bar/autocomplete_text_field_cell.h" | 5 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/mac/foundation_util.h" | 10 #include "base/mac/foundation_util.h" |
| (...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 654 number++, extension]; | 654 number++, extension]; |
| 655 } | 655 } |
| 656 | 656 |
| 657 return candidateName; | 657 return candidateName; |
| 658 } | 658 } |
| 659 | 659 |
| 660 - (NSArray*)namesOfPromisedFilesDroppedAtDestination:(NSURL*)dropDestination { | 660 - (NSArray*)namesOfPromisedFilesDroppedAtDestination:(NSURL*)dropDestination { |
| 661 NSPasteboard* pboard = [NSPasteboard pasteboardWithName:NSDragPboard]; | 661 NSPasteboard* pboard = [NSPasteboard pasteboardWithName:NSDragPboard]; |
| 662 NSFileManager* fileManager = [NSFileManager defaultManager]; | 662 NSFileManager* fileManager = [NSFileManager defaultManager]; |
| 663 | 663 |
| 664 if (![pboard containsURLData]) | 664 if (![pboard containsURLDataConvertingTextToURL:YES]) |
| 665 return NULL; | 665 return NULL; |
| 666 | 666 |
| 667 NSArray *urls = NULL; | 667 NSArray *urls = NULL; |
| 668 NSArray* titles = NULL; | 668 NSArray* titles = NULL; |
| 669 [pboard getURLs:&urls andTitles:&titles convertingFilenames:YES]; | 669 [pboard getURLs:&urls |
| 670 andTitles:&titles |
| 671 convertingFilenames:YES |
| 672 convertingTextToURL:YES]; |
| 670 | 673 |
| 671 NSString* urlStr = [urls objectAtIndex:0]; | 674 NSString* urlStr = [urls objectAtIndex:0]; |
| 672 NSString* nameStr = [titles objectAtIndex:0]; | 675 NSString* nameStr = [titles objectAtIndex:0]; |
| 673 | 676 |
| 674 NSString* nameWithExtensionStr = | 677 NSString* nameWithExtensionStr = |
| 675 UnusedLegalNameForNewDropFile(dropDestination, nameStr, @".webloc"); | 678 UnusedLegalNameForNewDropFile(dropDestination, nameStr, @".webloc"); |
| 676 if (!nameWithExtensionStr) | 679 if (!nameWithExtensionStr) |
| 677 return NULL; | 680 return NULL; |
| 678 | 681 |
| 679 NSDictionary* urlDict = [NSDictionary dictionaryWithObject:urlStr | 682 NSDictionary* urlDict = [NSDictionary dictionaryWithObject:urlStr |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 | 745 |
| 743 - (void)handleFocusEvent:(NSEvent*)event | 746 - (void)handleFocusEvent:(NSEvent*)event |
| 744 ofView:(AutocompleteTextField*)controlView { | 747 ofView:(AutocompleteTextField*)controlView { |
| 745 if ([controlView observer]) { | 748 if ([controlView observer]) { |
| 746 const bool controlDown = ([event modifierFlags] & NSControlKeyMask) != 0; | 749 const bool controlDown = ([event modifierFlags] & NSControlKeyMask) != 0; |
| 747 [controlView observer]->OnSetFocus(controlDown); | 750 [controlView observer]->OnSetFocus(controlDown); |
| 748 } | 751 } |
| 749 } | 752 } |
| 750 | 753 |
| 751 @end | 754 @end |
| OLD | NEW |