summaryrefslogtreecommitdiffstats
path: root/app/clipboard/clipboard_util_win.h
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-03 04:25:37 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-03 04:25:37 +0000
commit90f399075f9082bf7031512d6579ec1196dc060a (patch)
tree8d47273615d98732a60d0e77a0787d1623204a4b /app/clipboard/clipboard_util_win.h
parentf0f400cb2e0a3c545d723524e8bbaf136caacf81 (diff)
downloadchromium_src-90f399075f9082bf7031512d6579ec1196dc060a.zip
chromium_src-90f399075f9082bf7031512d6579ec1196dc060a.tar.gz
chromium_src-90f399075f9082bf7031512d6579ec1196dc060a.tar.bz2
Move the clipboard stuff out of base and into app/clipboard. I renamed
clipboard_util to clipboard_util_win since it's Windows-only. This patch makes test_shell depend on app as well. There should be no logic change. TEST=none BUG=none Review URL: http://codereview.chromium.org/260003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27937 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app/clipboard/clipboard_util_win.h')
-rw-r--r--app/clipboard/clipboard_util_win.h65
1 files changed, 65 insertions, 0 deletions
diff --git a/app/clipboard/clipboard_util_win.h b/app/clipboard/clipboard_util_win.h
new file mode 100644
index 0000000..5bbe8f0
--- /dev/null
+++ b/app/clipboard/clipboard_util_win.h
@@ -0,0 +1,65 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Some helper functions for working with the clipboard and IDataObjects.
+
+#ifndef APP_CLIPBOARD_CLIPBOARD_UTIL_WIN_H_
+#define APP_CLIPBOARD_CLIPBOARD_UTIL_WIN_H_
+
+#include <shlobj.h>
+#include <string>
+#include <vector>
+
+class ClipboardUtil {
+ public:
+ /////////////////////////////////////////////////////////////////////////////
+ // Clipboard formats.
+ static FORMATETC* GetUrlFormat();
+ static FORMATETC* GetUrlWFormat();
+ static FORMATETC* GetMozUrlFormat();
+ static FORMATETC* GetPlainTextFormat();
+ static FORMATETC* GetPlainTextWFormat();
+ static FORMATETC* GetFilenameFormat();
+ static FORMATETC* GetFilenameWFormat();
+ // MS HTML Format
+ static FORMATETC* GetHtmlFormat();
+ // Firefox text/html
+ static FORMATETC* GetTextHtmlFormat();
+ static FORMATETC* GetCFHDropFormat();
+ static FORMATETC* GetFileDescriptorFormat();
+ static FORMATETC* GetFileContentFormatZero();
+ static FORMATETC* GetWebKitSmartPasteFormat();
+
+ /////////////////////////////////////////////////////////////////////////////
+ // These methods check to see if |data_object| has the requested type.
+ // Returns true if it does.
+ static bool HasUrl(IDataObject* data_object);
+ static bool HasFilenames(IDataObject* data_object);
+ static bool HasPlainText(IDataObject* data_object);
+ static bool HasFileContents(IDataObject* data_object);
+ static bool HasHtml(IDataObject* data_object);
+
+ /////////////////////////////////////////////////////////////////////////////
+ // Helper methods to extract information from an IDataObject. These methods
+ // return true if the requested data type is found in |data_object|.
+ static bool GetUrl(IDataObject* data_object,
+ std::wstring* url, std::wstring* title);
+ static bool GetFilenames(IDataObject* data_object,
+ std::vector<std::wstring>* filenames);
+ static bool GetPlainText(IDataObject* data_object, std::wstring* plain_text);
+ static bool GetHtml(IDataObject* data_object, std::wstring* text_html,
+ std::string* base_url);
+ static bool GetFileContents(IDataObject* data_object,
+ std::wstring* filename,
+ std::string* file_contents);
+
+ // A helper method for converting between MS CF_HTML format and plain
+ // text/html.
+ static std::string HtmlToCFHtml(const std::string& html,
+ const std::string& base_url);
+ static void CFHtmlToHtml(const std::string& cf_html, std::string* html,
+ std::string* base_url);
+};
+
+#endif // APP_CLIPBOARD_CLIPBOARD_UTIL_WIN_H_