| 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 26 matching lines...) Expand all Loading... |
| 37 #include "core/html/HTMLImageElement.h" | 37 #include "core/html/HTMLImageElement.h" |
| 38 #include "core/rendering/RenderImage.h" | 38 #include "core/rendering/RenderImage.h" |
| 39 #include "core/rendering/RenderObject.h" | 39 #include "core/rendering/RenderObject.h" |
| 40 #include "platform/DragImage.h" | 40 #include "platform/DragImage.h" |
| 41 #include "platform/MIMETypeRegistry.h" | 41 #include "platform/MIMETypeRegistry.h" |
| 42 #include "platform/clipboard/ClipboardMimeTypes.h" | 42 #include "platform/clipboard/ClipboardMimeTypes.h" |
| 43 #include "platform/clipboard/ClipboardUtilities.h" | 43 #include "platform/clipboard/ClipboardUtilities.h" |
| 44 | 44 |
| 45 namespace WebCore { | 45 namespace WebCore { |
| 46 | 46 |
| 47 DEFINE_GC_INFO(Clipboard); |
| 48 |
| 47 // These "conversion" methods are called by both WebCore and WebKit, and never m
ake sense to JS, so we don't | 49 // These "conversion" methods are called by both WebCore and WebKit, and never m
ake sense to JS, so we don't |
| 48 // worry about security for these. They don't allow access to the pasteboard any
way. | 50 // worry about security for these. They don't allow access to the pasteboard any
way. |
| 49 static DragOperation dragOpFromIEOp(const String& op) | 51 static DragOperation dragOpFromIEOp(const String& op) |
| 50 { | 52 { |
| 51 // yep, it's really just this fixed set | 53 // yep, it's really just this fixed set |
| 52 if (op == "uninitialized") | 54 if (op == "uninitialized") |
| 53 return DragOperationEvery; | 55 return DragOperationEvery; |
| 54 if (op == "none") | 56 if (op == "none") |
| 55 return DragOperationNone; | 57 return DragOperationNone; |
| 56 if (op == "copy") | 58 if (op == "copy") |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 if (cleanType == mimeTypeText || cleanType.startsWith(mimeTypeTextPlainEtc)) | 102 if (cleanType == mimeTypeText || cleanType.startsWith(mimeTypeTextPlainEtc)) |
| 101 return mimeTypeTextPlain; | 103 return mimeTypeTextPlain; |
| 102 if (cleanType == mimeTypeURL) { | 104 if (cleanType == mimeTypeURL) { |
| 103 if (convertToURL) | 105 if (convertToURL) |
| 104 *convertToURL = true; | 106 *convertToURL = true; |
| 105 return mimeTypeTextURIList; | 107 return mimeTypeTextURIList; |
| 106 } | 108 } |
| 107 return cleanType; | 109 return cleanType; |
| 108 } | 110 } |
| 109 | 111 |
| 110 PassRefPtr<Clipboard> Clipboard::create(ClipboardType type, ClipboardAccessPolic
y policy, PassRefPtr<DataObject> dataObject) | 112 PassRefPtrWillBeRawPtr<Clipboard> Clipboard::create(ClipboardType type, Clipboar
dAccessPolicy policy, PassRefPtrWillBeRawPtr<DataObject> dataObject) |
| 111 { | 113 { |
| 112 return adoptRef(new Clipboard(type, policy , dataObject)); | 114 return adoptRefWillBeNoop(new Clipboard(type, policy , dataObject)); |
| 113 } | 115 } |
| 114 | 116 |
| 115 Clipboard::~Clipboard() | 117 Clipboard::~Clipboard() |
| 116 { | 118 { |
| 117 } | 119 } |
| 118 | 120 |
| 119 void Clipboard::setDropEffect(const String &effect) | 121 void Clipboard::setDropEffect(const String &effect) |
| 120 { | 122 { |
| 121 if (!isForDragAndDrop()) | 123 if (!isForDragAndDrop()) |
| 122 return; | 124 return; |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 { | 435 { |
| 434 if (keyword.startsWith("file:")) | 436 if (keyword.startsWith("file:")) |
| 435 return hasFileOfType(keyword.substring(5)); | 437 return hasFileOfType(keyword.substring(5)); |
| 436 | 438 |
| 437 if (keyword.startsWith("string:")) | 439 if (keyword.startsWith("string:")) |
| 438 return hasStringOfType(keyword.substring(7)); | 440 return hasStringOfType(keyword.substring(7)); |
| 439 | 441 |
| 440 return false; | 442 return false; |
| 441 } | 443 } |
| 442 | 444 |
| 443 PassRefPtr<DataTransferItemList> Clipboard::items() | 445 PassRefPtrWillBeRawPtr<DataTransferItemList> Clipboard::items() |
| 444 { | 446 { |
| 445 // FIXME: According to the spec, we are supposed to return the same collecti
on of items each | 447 // FIXME: According to the spec, we are supposed to return the same collecti
on of items each |
| 446 // time. We now return a wrapper that always wraps the *same* set of items,
so JS shouldn't be | 448 // time. We now return a wrapper that always wraps the *same* set of items,
so JS shouldn't be |
| 447 // able to tell, but we probably still want to fix this. | 449 // able to tell, but we probably still want to fix this. |
| 448 return DataTransferItemList::create(this, m_dataObject); | 450 return DataTransferItemList::create(this, m_dataObject); |
| 449 } | 451 } |
| 450 | 452 |
| 451 PassRefPtr<DataObject> Clipboard::dataObject() const | 453 PassRefPtrWillBeRawPtr<DataObject> Clipboard::dataObject() const |
| 452 { | 454 { |
| 453 return m_dataObject; | 455 return m_dataObject; |
| 454 } | 456 } |
| 455 | 457 |
| 456 Clipboard::Clipboard(ClipboardType type, ClipboardAccessPolicy policy, PassRefPt
r<DataObject> dataObject) | 458 Clipboard::Clipboard(ClipboardType type, ClipboardAccessPolicy policy, PassRefPt
rWillBeRawPtr<DataObject> dataObject) |
| 457 : m_policy(policy) | 459 : m_policy(policy) |
| 458 , m_dropEffect("uninitialized") | 460 , m_dropEffect("uninitialized") |
| 459 , m_effectAllowed("uninitialized") | 461 , m_effectAllowed("uninitialized") |
| 460 , m_clipboardType(type) | 462 , m_clipboardType(type) |
| 461 , m_dataObject(dataObject) | 463 , m_dataObject(dataObject) |
| 462 { | 464 { |
| 463 ScriptWrappable::init(this); | 465 ScriptWrappable::init(this); |
| 464 } | 466 } |
| 465 | 467 |
| 466 void Clipboard::setDragImage(ImageResource* image, Node* node, const IntPoint& l
oc) | 468 void Clipboard::setDragImage(ImageResource* image, Node* node, const IntPoint& l
oc) |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 return String("copy"); | 517 return String("copy"); |
| 516 case DragOperationMove: | 518 case DragOperationMove: |
| 517 return String("move"); | 519 return String("move"); |
| 518 case DragOperationLink: | 520 case DragOperationLink: |
| 519 return String("link"); | 521 return String("link"); |
| 520 default: | 522 default: |
| 521 return String("copy"); | 523 return String("copy"); |
| 522 } | 524 } |
| 523 } | 525 } |
| 524 | 526 |
| 527 void Clipboard::trace(Visitor* visitor) |
| 528 { |
| 529 visitor->trace(m_dataObject); |
| 530 } |
| 531 |
| 525 } // namespace WebCore | 532 } // namespace WebCore |
| OLD | NEW |