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 "content/browser/web_contents/web_drag_source_mac.h" | 5 #import "content/browser/web_contents/web_drag_source_mac.h" |
6 | 6 |
7 #include <sys/param.h> | 7 #include <sys/param.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/files/file.h" | 10 #include "base/files/file.h" |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 forType:base::mac::CFToNSCast(fileUTI_.get())]; | 193 forType:base::mac::CFToNSCast(fileUTI_.get())]; |
194 | 194 |
195 // Plain text. | 195 // Plain text. |
196 } else if ([type isEqualToString:NSStringPboardType]) { | 196 } else if ([type isEqualToString:NSStringPboardType]) { |
197 DCHECK(!dropData_->text.string().empty()); | 197 DCHECK(!dropData_->text.string().empty()); |
198 [pboard setString:SysUTF16ToNSString(dropData_->text.string()) | 198 [pboard setString:SysUTF16ToNSString(dropData_->text.string()) |
199 forType:NSStringPboardType]; | 199 forType:NSStringPboardType]; |
200 | 200 |
201 // Custom MIME data. | 201 // Custom MIME data. |
202 } else if ([type isEqualToString:ui::kWebCustomDataPboardType]) { | 202 } else if ([type isEqualToString:ui::kWebCustomDataPboardType]) { |
203 Pickle pickle; | 203 base::Pickle pickle; |
204 ui::WriteCustomDataToPickle(dropData_->custom_data, &pickle); | 204 ui::WriteCustomDataToPickle(dropData_->custom_data, &pickle); |
205 [pboard setData:[NSData dataWithBytes:pickle.data() length:pickle.size()] | 205 [pboard setData:[NSData dataWithBytes:pickle.data() length:pickle.size()] |
206 forType:ui::kWebCustomDataPboardType]; | 206 forType:ui::kWebCustomDataPboardType]; |
207 | 207 |
208 // Dummy type. | 208 // Dummy type. |
209 } else if ([type isEqualToString:ui::kChromeDragDummyPboardType]) { | 209 } else if ([type isEqualToString:ui::kChromeDragDummyPboardType]) { |
210 // The dummy type _was_ promised and someone decided to call the bluff. | 210 // The dummy type _was_ promised and someone decided to call the bluff. |
211 [pboard setData:[NSData data] | 211 [pboard setData:[NSData data] |
212 forType:ui::kChromeDragDummyPboardType]; | 212 forType:ui::kChromeDragDummyPboardType]; |
213 | 213 |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 - (NSImage*)dragImage { | 457 - (NSImage*)dragImage { |
458 if (dragImage_) | 458 if (dragImage_) |
459 return dragImage_; | 459 return dragImage_; |
460 | 460 |
461 // Default to returning a generic image. | 461 // Default to returning a generic image. |
462 return content::GetContentClient()->GetNativeImageNamed( | 462 return content::GetContentClient()->GetNativeImageNamed( |
463 IDR_DEFAULT_FAVICON).ToNSImage(); | 463 IDR_DEFAULT_FAVICON).ToNSImage(); |
464 } | 464 } |
465 | 465 |
466 @end // @implementation WebDragSource (Private) | 466 @end // @implementation WebDragSource (Private) |
OLD | NEW |