| 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 #include "base/mac/scoped_nsobject.h" | 5 #include "base/mac/scoped_nsobject.h" |
| 6 #include "base/strings/string16.h" | 6 #include "base/strings/string16.h" |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 8 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" | 10 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 - (NSDragOperation)draggingSourceOperationMask { | 105 - (NSDragOperation)draggingSourceOperationMask { |
| 106 return NSDragOperationCopy | NSDragOperationMove; | 106 return NSDragOperationCopy | NSDragOperationMove; |
| 107 } | 107 } |
| 108 | 108 |
| 109 - (NSPoint)draggingLocation { | 109 - (NSPoint)draggingLocation { |
| 110 return kPoint; | 110 return kPoint; |
| 111 } | 111 } |
| 112 | 112 |
| 113 // NSPasteboard mocking functions. | 113 // NSPasteboard mocking functions. |
| 114 | 114 |
| 115 - (BOOL)containsURLData { | 115 - (BOOL)containsURLDataConvertingTextToURL:(BOOL)convertTextToURL { |
| 116 NSArray* urlTypes = [URLDropTargetHandler handledDragTypes]; | 116 NSArray* urlTypes = [URLDropTargetHandler handledDragTypes]; |
| 117 if (dragDataType_) | 117 if (dragDataType_) |
| 118 return [urlTypes containsObject:dragDataType_]; | 118 return [urlTypes containsObject:dragDataType_]; |
| 119 return NO; | 119 return NO; |
| 120 } | 120 } |
| 121 | 121 |
| 122 - (NSData*)dataForType:(NSString*)type { | 122 - (NSData*)dataForType:(NSString*)type { |
| 123 if (dragDataType_ && [dragDataType_ isEqualToString:type]) { | 123 if (dragDataType_ && [dragDataType_ isEqualToString:type]) { |
| 124 if (button_) | 124 if (button_) |
| 125 return [NSData dataWithBytes:&button_ length:sizeof(button_)]; | 125 return [NSData dataWithBytes:&button_ length:sizeof(button_)]; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 136 dragButtonToShouldCopy_ = copy; | 136 dragButtonToShouldCopy_ = copy; |
| 137 return YES; | 137 return YES; |
| 138 } | 138 } |
| 139 | 139 |
| 140 - (BOOL)addURLs:(NSArray*)urls withTitles:(NSArray*)titles at:(NSPoint)point { | 140 - (BOOL)addURLs:(NSArray*)urls withTitles:(NSArray*)titles at:(NSPoint)point { |
| 141 dragURLsPong_ = YES; | 141 dragURLsPong_ = YES; |
| 142 return YES; | 142 return YES; |
| 143 } | 143 } |
| 144 | 144 |
| 145 - (void)getURLs:(NSArray**)outUrls | 145 - (void)getURLs:(NSArray**)outUrls |
| 146 andTitles:(NSArray**)outTitles | 146 andTitles:(NSArray**)outTitles |
| 147 convertingFilenames:(BOOL)convertFilenames { | 147 convertingFilenames:(BOOL)convertFilenames |
| 148 convertingTextToURL:(BOOL)convertTextToURL { |
| 148 } | 149 } |
| 149 | 150 |
| 150 - (BOOL)dragBookmarkData:(id<NSDraggingInfo>)info { | 151 - (BOOL)dragBookmarkData:(id<NSDraggingInfo>)info { |
| 151 dragBookmarkDataPong_ = YES; | 152 dragBookmarkDataPong_ = YES; |
| 152 return NO; | 153 return NO; |
| 153 } | 154 } |
| 154 | 155 |
| 155 - (BOOL)canEditBookmarks { | 156 - (BOOL)canEditBookmarks { |
| 156 return YES; | 157 return YES; |
| 157 } | 158 } |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 EXPECT_TRUE([info draggingEnteredCalled]); // Ensure controller pinged. | 328 EXPECT_TRUE([info draggingEnteredCalled]); // Ensure controller pinged. |
| 328 EXPECT_TRUE([view_ dropIndicatorShown]); | 329 EXPECT_TRUE([view_ dropIndicatorShown]); |
| 329 EXPECT_EQ([view_ dropIndicatorPosition], kFakeIndicatorPos); | 330 EXPECT_EQ([view_ dropIndicatorPosition], kFakeIndicatorPos); |
| 330 | 331 |
| 331 [info setDropIndicatorShown:NO]; | 332 [info setDropIndicatorShown:NO]; |
| 332 EXPECT_EQ([view_ draggingEntered:(id)info.get()], NSDragOperationMove); | 333 EXPECT_EQ([view_ draggingEntered:(id)info.get()], NSDragOperationMove); |
| 333 EXPECT_FALSE([view_ dropIndicatorShown]); | 334 EXPECT_FALSE([view_ dropIndicatorShown]); |
| 334 } | 335 } |
| 335 | 336 |
| 336 } // namespace | 337 } // namespace |
| OLD | NEW |