diff options
author | jeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-02 22:31:31 +0000 |
---|---|---|
committer | jeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-02 22:31:31 +0000 |
commit | b8a21ec037ae12cda22e6429fa6581f98d2914ba (patch) | |
tree | a8cf2388b32014b23a56bdf778efb148a18a9970 /base/clipboard_win.cc | |
parent | aad08754d7ff3be93fd415a36a588fadd2e34bd0 (diff) | |
download | chromium_src-b8a21ec037ae12cda22e6429fa6581f98d2914ba.zip chromium_src-b8a21ec037ae12cda22e6429fa6581f98d2914ba.tar.gz chromium_src-b8a21ec037ae12cda22e6429fa6581f98d2914ba.tar.bz2 |
Bring up clipboard_unittest.cc on the Mac.
Review URL: http://codereview.chromium.org/6424
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2815 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/clipboard_win.cc')
-rw-r--r-- | base/clipboard_win.cc | 84 |
1 files changed, 77 insertions, 7 deletions
diff --git a/base/clipboard_win.cc b/base/clipboard_win.cc index 0aba865b..dfdd3db 100644 --- a/base/clipboard_win.cc +++ b/base/clipboard_win.cc @@ -178,8 +178,7 @@ void Clipboard::WriteHTML(const std::wstring& markup, std::string html_fragment; MarkupToHTMLClipboardFormat(markup, url, &html_fragment); HGLOBAL glob = CreateGlobalData(html_fragment); - if (glob && !::SetClipboardData(ClipboardUtil::GetHtmlFormat()->cfFormat, - glob)) { + if (glob && !::SetClipboardData(GetHtmlFormatType(), glob)) { ::GlobalFree(glob); } } @@ -195,8 +194,7 @@ void Clipboard::WriteBookmark(const std::wstring& title, bookmark.append(1, L'\n'); bookmark.append(UTF8ToWide(url)); HGLOBAL glob = CreateGlobalData(bookmark); - if (glob && !::SetClipboardData(ClipboardUtil::GetUrlWFormat()->cfFormat, - glob)) { + if (glob && !::SetClipboardData(GetUrlWFormatType(), glob)) { ::GlobalFree(glob); } } @@ -223,7 +221,7 @@ void Clipboard::WriteWebSmartPaste() { if (!lock.Acquire(clipboard_owner_)) return; - SetClipboardData(ClipboardUtil::GetWebKitSmartPasteFormat()->cfFormat, NULL); + SetClipboardData(GetWebKitSmartPasteFormatType(), NULL); } void Clipboard::WriteBitmap(const void* pixels, const gfx::Size& size) { @@ -437,7 +435,7 @@ void Clipboard::ReadHTML(std::wstring* markup, std::string* src_url) const { if (!lock.Acquire(clipboard_owner_)) return; - HANDLE data = ::GetClipboardData(ClipboardUtil::GetHtmlFormat()->cfFormat); + HANDLE data = ::GetClipboardData(GetHtmlFormatType()); if (!data) return; @@ -459,7 +457,7 @@ void Clipboard::ReadBookmark(std::wstring* title, std::string* url) const { if (!lock.Acquire(clipboard_owner_)) return; - HANDLE data = ::GetClipboardData(ClipboardUtil::GetUrlWFormat()->cfFormat); + HANDLE data = ::GetClipboardData(GetUrlWFormatType()); if (!data) return; @@ -632,3 +630,75 @@ void Clipboard::ParseBookmarkClipboardFormat(const std::wstring& bookmark, } } +// static +Clipboard::FormatType Clipboard::GetUrlFormatType() { + return ClipboardUtil::GetUrlFormat()->cfFormat; +} + +// static +Clipboard::FormatType Clipboard::GetUrlWFormatType() { + return ClipboardUtil::GetUrlWFormat()->cfFormat; +} + +// static +Clipboard::FormatType Clipboard::GetMozUrlFormatType() { + return ClipboardUtil::GetMozUrlFormat()->cfFormat; +} + +// static +Clipboard::FormatType Clipboard::GetPlainTextFormatType() { + return ClipboardUtil::GetPlainTextFormat()->cfFormat; +} + +// static +Clipboard::FormatType Clipboard::GetPlainTextWFormatType() { + return ClipboardUtil::GetPlainTextWFormat()->cfFormat; +} + +// static +Clipboard::FormatType Clipboard::GetFilenameFormatType() { + return ClipboardUtil::GetFilenameFormat()->cfFormat; +} + +// static +Clipboard::FormatType Clipboard::GetFilenameWFormatType() { + return ClipboardUtil::GetFilenameWFormat()->cfFormat; +} + +// MS HTML Format +// static +Clipboard::FormatType Clipboard::GetHtmlFormatType() { + return ClipboardUtil::GetHtmlFormat()->cfFormat; +} + +// static +Clipboard::FormatType Clipboard::GetBitmapFormatType() { + return CF_BITMAP; +} + +// Firefox text/html +// static +Clipboard::FormatType Clipboard::GetTextHtmlFormatType() { + return ClipboardUtil::GetTextHtmlFormat()->cfFormat; +} + +// static +Clipboard::FormatType Clipboard::GetCFHDropFormatType() { + return ClipboardUtil::GetCFHDropFormat()->cfFormat; +} + +// static +Clipboard::FormatType Clipboard::GetFileDescriptorFormatType() { + return ClipboardUtil::GetFileDescriptorFormat()->cfFormat; +} + +// static +Clipboard::FormatType Clipboard::GetFileContentFormatZeroType() { + return ClipboardUtil::GetFileContentFormatZero()->cfFormat; +} + +// static +Clipboard::FormatType Clipboard::GetWebKitSmartPasteFormatType() { + return ClipboardUtil::GetWebKitSmartPasteFormat()->cfFormat; +} + |