OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/tab_contents/web_drag_source_mac.h" | 5 #import "content/browser/tab_contents/web_drag_source_mac.h" |
6 | 6 |
7 #include <sys/param.h> | 7 #include <sys/param.h> |
8 | 8 |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 return self; | 154 return self; |
155 } | 155 } |
156 | 156 |
157 - (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)isLocal { | 157 - (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)isLocal { |
158 return dragOperationMask_; | 158 return dragOperationMask_; |
159 } | 159 } |
160 | 160 |
161 - (void)lazyWriteToPasteboard:(NSPasteboard*)pboard forType:(NSString*)type { | 161 - (void)lazyWriteToPasteboard:(NSPasteboard*)pboard forType:(NSString*)type { |
162 // NSHTMLPboardType requires the character set to be declared. Otherwise, it | 162 // NSHTMLPboardType requires the character set to be declared. Otherwise, it |
163 // assumes US-ASCII. Awesome. | 163 // assumes US-ASCII. Awesome. |
164 static const string16 kHtmlHeader = | 164 const string16 kHtmlHeader = ASCIIToUTF16( |
165 ASCIIToUTF16("<meta http-equiv=\"Content-Type\" " | 165 "<meta http-equiv=\"Content-Type\" content=\"text/html;charset=UTF-8\">"); |
166 "content=\"text/html;charset=UTF-8\">"); | |
167 | 166 |
168 // Be extra paranoid; avoid crashing. | 167 // Be extra paranoid; avoid crashing. |
169 if (!dropData_.get()) { | 168 if (!dropData_.get()) { |
170 NOTREACHED() << "No drag-and-drop data available for lazy write."; | 169 NOTREACHED() << "No drag-and-drop data available for lazy write."; |
171 return; | 170 return; |
172 } | 171 } |
173 | 172 |
174 // HTML. | 173 // HTML. |
175 if ([type isEqualToString:NSHTMLPboardType]) { | 174 if ([type isEqualToString:NSHTMLPboardType]) { |
176 DCHECK(!dropData_->text_html.empty()); | 175 DCHECK(!dropData_->text_html.empty()); |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 | 446 |
448 - (NSImage*)dragImage { | 447 - (NSImage*)dragImage { |
449 if (dragImage_) | 448 if (dragImage_) |
450 return dragImage_; | 449 return dragImage_; |
451 | 450 |
452 // Default to returning a generic image. | 451 // Default to returning a generic image. |
453 return gfx::GetCachedImageWithName(@"nav.pdf"); | 452 return gfx::GetCachedImageWithName(@"nav.pdf"); |
454 } | 453 } |
455 | 454 |
456 @end // @implementation WebDragSource (Private) | 455 @end // @implementation WebDragSource (Private) |
OLD | NEW |