OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 { | 189 { |
190 Vector<String> types; | 190 Vector<String> types; |
191 if (!canReadTypes()) | 191 if (!canReadTypes()) |
192 return types; | 192 return types; |
193 | 193 |
194 ListHashSet<String> typesSet = m_dataObject->types(); | 194 ListHashSet<String> typesSet = m_dataObject->types(); |
195 types.appendRange(typesSet.begin(), typesSet.end()); | 195 types.appendRange(typesSet.begin(), typesSet.end()); |
196 return types; | 196 return types; |
197 } | 197 } |
198 | 198 |
199 PassRefPtr<FileList> Clipboard::files() const | 199 PassRefPtrWillBeRawPtr<FileList> Clipboard::files() const |
200 { | 200 { |
201 RefPtr<FileList> files = FileList::create(); | 201 RefPtrWillBeRawPtr<FileList> files = FileList::create(); |
202 if (!canReadData()) | 202 if (!canReadData()) |
203 return files.release(); | 203 return files.release(); |
204 | 204 |
205 for (size_t i = 0; i < m_dataObject->length(); ++i) { | 205 for (size_t i = 0; i < m_dataObject->length(); ++i) { |
206 if (m_dataObject->item(i)->kind() == DataObjectItem::FileKind) { | 206 if (m_dataObject->item(i)->kind() == DataObjectItem::FileKind) { |
207 RefPtr<Blob> blob = m_dataObject->item(i)->getAsFile(); | 207 RefPtrWillBeRawPtr<Blob> blob = m_dataObject->item(i)->getAsFile(); |
208 if (blob && blob->isFile()) | 208 if (blob && blob->isFile()) |
209 files->append(toFile(blob.get())); | 209 files->append(toFile(blob.get())); |
210 } | 210 } |
211 } | 211 } |
212 | 212 |
213 return files.release(); | 213 return files.release(); |
214 } | 214 } |
215 | 215 |
216 void Clipboard::setDragImage(Element* image, int x, int y, ExceptionState& excep
tionState) | 216 void Clipboard::setDragImage(Element* image, int x, int y, ExceptionState& excep
tionState) |
217 { | 217 { |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 m_dragImage = image; | 473 m_dragImage = image; |
474 m_dragLoc = loc; | 474 m_dragLoc = loc; |
475 m_dragImageElement = node; | 475 m_dragImageElement = node; |
476 } | 476 } |
477 | 477 |
478 bool Clipboard::hasFileOfType(const String& type) const | 478 bool Clipboard::hasFileOfType(const String& type) const |
479 { | 479 { |
480 if (!canReadTypes()) | 480 if (!canReadTypes()) |
481 return false; | 481 return false; |
482 | 482 |
483 RefPtr<FileList> fileList = files(); | 483 RefPtrWillBeRawPtr<FileList> fileList = files(); |
484 if (fileList->isEmpty()) | 484 if (fileList->isEmpty()) |
485 return false; | 485 return false; |
486 | 486 |
487 for (unsigned f = 0; f < fileList->length(); f++) { | 487 for (unsigned f = 0; f < fileList->length(); f++) { |
488 if (equalIgnoringCase(fileList->item(f)->type(), type)) | 488 if (equalIgnoringCase(fileList->item(f)->type(), type)) |
489 return true; | 489 return true; |
490 } | 490 } |
491 return false; | 491 return false; |
492 } | 492 } |
493 | 493 |
(...skipping 29 matching lines...) Expand all Loading... |
523 return String("copy"); | 523 return String("copy"); |
524 } | 524 } |
525 } | 525 } |
526 | 526 |
527 void Clipboard::trace(Visitor* visitor) | 527 void Clipboard::trace(Visitor* visitor) |
528 { | 528 { |
529 visitor->trace(m_dataObject); | 529 visitor->trace(m_dataObject); |
530 } | 530 } |
531 | 531 |
532 } // namespace WebCore | 532 } // namespace WebCore |
OLD | NEW |