2011-02-04 Daniel Cheng <dcheng@chromium.org>
[WebKit.git] / Source / WebCore / platform / chromium / ReadableDataObject.cpp
index dbf47390d69f9bc75f76106bb2af0553c42768c6..484a1b3294ece61b2e7a1f8fc2bcec108800fd72 100644 (file)
@@ -43,13 +43,14 @@ static PasteboardPrivate::ClipboardBuffer clipboardBuffer(Clipboard::ClipboardTy
     return clipboardType == Clipboard::DragAndDrop ? PasteboardPrivate::DragBuffer : PasteboardPrivate::StandardBuffer;
 }
 
-PassRefPtr<ReadableDataObject> ReadableDataObject::create(Clipboard::ClipboardType clipboardType)
+PassRefPtr<ReadableDataObject> ReadableDataObject::create(const Frame* frame, Clipboard::ClipboardType clipboardType)
 {
-    return adoptRef(new ReadableDataObject(clipboardType));
+    return adoptRef(new ReadableDataObject(frame, clipboardType));
 }
 
-ReadableDataObject::ReadableDataObject(Clipboard::ClipboardType clipboardType)
-    : m_clipboardType(clipboardType)
+ReadableDataObject::ReadableDataObject(const Frame* frame, Clipboard::ClipboardType clipboardType)
+    : m_frame(frame)
+    , m_clipboardType(clipboardType)
     , m_containsFilenames(false)
     , m_isTypeCacheInitialized(false)
 {
@@ -93,7 +94,7 @@ String ReadableDataObject::getData(const String& type, bool& succeeded) const
         return data;
     }
     succeeded = PlatformBridge::clipboardReadData(
-        clipboardBuffer(m_clipboardType), type, data, ignoredMetadata);
+        m_frame, clipboardBuffer(m_clipboardType), type, data, ignoredMetadata);
     return data;
 }
 
@@ -102,7 +103,7 @@ String ReadableDataObject::urlTitle() const
     String ignoredData;
     String urlTitle;
     PlatformBridge::clipboardReadData(
-        clipboardBuffer(m_clipboardType), mimeTypeTextURIList, ignoredData, urlTitle);
+        m_frame, clipboardBuffer(m_clipboardType), mimeTypeTextURIList, ignoredData, urlTitle);
     return urlTitle;
 }
 
@@ -111,7 +112,7 @@ KURL ReadableDataObject::htmlBaseUrl() const
     String ignoredData;
     String htmlBaseUrl;
     PlatformBridge::clipboardReadData(
-        clipboardBuffer(m_clipboardType), mimeTypeTextHTML, ignoredData, htmlBaseUrl);
+        m_frame, clipboardBuffer(m_clipboardType), mimeTypeTextHTML, ignoredData, htmlBaseUrl);
     return KURL(ParsedURLString, htmlBaseUrl);
 }
 
@@ -123,7 +124,7 @@ bool ReadableDataObject::containsFilenames() const
 
 Vector<String> ReadableDataObject::filenames() const
 {
-    return PlatformBridge::clipboardReadFilenames(clipboardBuffer(m_clipboardType));
+    return PlatformBridge::clipboardReadFilenames(m_frame, clipboardBuffer(m_clipboardType));
 }
 
 void ReadableDataObject::ensureTypeCacheInitialized() const
@@ -132,7 +133,7 @@ void ReadableDataObject::ensureTypeCacheInitialized() const
         return;
 
     m_types = PlatformBridge::clipboardReadAvailableTypes(
-        clipboardBuffer(m_clipboardType), &m_containsFilenames);
+        m_frame, clipboardBuffer(m_clipboardType), &m_containsFilenames);
     m_isTypeCacheInitialized = true;
 }