| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 // | 4 // |
| 5 // Some helper functions for working with the clipboard and IDataObjects. | 5 // Some helper functions for working with the clipboard and IDataObjects. |
| 6 | 6 |
| 7 #ifndef UI_BASE_CLIPBOARD_CLIPBOARD_UTIL_WIN_H_ | 7 #ifndef UI_BASE_CLIPBOARD_CLIPBOARD_UTIL_WIN_H_ |
| 8 #define UI_BASE_CLIPBOARD_CLIPBOARD_UTIL_WIN_H_ | 8 #define UI_BASE_CLIPBOARD_CLIPBOARD_UTIL_WIN_H_ |
| 9 | 9 |
| 10 #include <shlobj.h> | 10 #include <shlobj.h> |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 static bool HasUrl(IDataObject* data_object); | 25 static bool HasUrl(IDataObject* data_object); |
| 26 static bool HasFilenames(IDataObject* data_object); | 26 static bool HasFilenames(IDataObject* data_object); |
| 27 static bool HasPlainText(IDataObject* data_object); | 27 static bool HasPlainText(IDataObject* data_object); |
| 28 static bool HasFileContents(IDataObject* data_object); | 28 static bool HasFileContents(IDataObject* data_object); |
| 29 static bool HasHtml(IDataObject* data_object); | 29 static bool HasHtml(IDataObject* data_object); |
| 30 | 30 |
| 31 ///////////////////////////////////////////////////////////////////////////// | 31 ///////////////////////////////////////////////////////////////////////////// |
| 32 // Helper methods to extract information from an IDataObject. These methods | 32 // Helper methods to extract information from an IDataObject. These methods |
| 33 // return true if the requested data type is found in |data_object|. | 33 // return true if the requested data type is found in |data_object|. |
| 34 static bool GetUrl(IDataObject* data_object, | 34 static bool GetUrl(IDataObject* data_object, |
| 35 string16* url, | 35 base::string16* url, |
| 36 string16* title, | 36 base::string16* title, |
| 37 bool convert_filenames); | 37 bool convert_filenames); |
| 38 static bool GetFilenames(IDataObject* data_object, | 38 static bool GetFilenames(IDataObject* data_object, |
| 39 std::vector<string16>* filenames); | 39 std::vector<base::string16>* filenames); |
| 40 static bool GetPlainText(IDataObject* data_object, string16* plain_text); | 40 static bool GetPlainText(IDataObject* data_object, |
| 41 base::string16* plain_text); |
| 41 static bool GetHtml(IDataObject* data_object, | 42 static bool GetHtml(IDataObject* data_object, |
| 42 string16* text_html, | 43 base::string16* text_html, |
| 43 std::string* base_url); | 44 std::string* base_url); |
| 44 static bool GetFileContents(IDataObject* data_object, | 45 static bool GetFileContents(IDataObject* data_object, |
| 45 string16* filename, | 46 base::string16* filename, |
| 46 std::string* file_contents); | 47 std::string* file_contents); |
| 47 // This represents custom MIME types a web page might set to transport its | 48 // This represents custom MIME types a web page might set to transport its |
| 48 // own types of data for drag and drop. It is sandboxed in its own CLIPFORMAT | 49 // own types of data for drag and drop. It is sandboxed in its own CLIPFORMAT |
| 49 // to avoid polluting the ::RegisterClipboardFormat() namespace with random | 50 // to avoid polluting the ::RegisterClipboardFormat() namespace with random |
| 50 // strings from web content. | 51 // strings from web content. |
| 51 static bool GetWebCustomData(IDataObject* data_object, | 52 static bool GetWebCustomData( |
| 52 std::map<string16, string16>* custom_data); | 53 IDataObject* data_object, |
| 54 std::map<base::string16, base::string16>* custom_data); |
| 53 | 55 |
| 54 // Helper method for converting between MS CF_HTML format and plain | 56 // Helper method for converting between MS CF_HTML format and plain |
| 55 // text/html. | 57 // text/html. |
| 56 static std::string HtmlToCFHtml(const std::string& html, | 58 static std::string HtmlToCFHtml(const std::string& html, |
| 57 const std::string& base_url); | 59 const std::string& base_url); |
| 58 static void CFHtmlToHtml(const std::string& cf_html, | 60 static void CFHtmlToHtml(const std::string& cf_html, |
| 59 std::string* html, | 61 std::string* html, |
| 60 std::string* base_url); | 62 std::string* base_url); |
| 61 static void CFHtmlExtractMetadata(const std::string& cf_html, | 63 static void CFHtmlExtractMetadata(const std::string& cf_html, |
| 62 std::string* base_url, | 64 std::string* base_url, |
| 63 size_t* html_start, | 65 size_t* html_start, |
| 64 size_t* fragment_start, | 66 size_t* fragment_start, |
| 65 size_t* fragment_end); | 67 size_t* fragment_end); |
| 66 }; | 68 }; |
| 67 | 69 |
| 68 } | 70 } |
| 69 | 71 |
| 70 #endif // UI_BASE_CLIPBOARD_CLIPBOARD_UTIL_WIN_H_ | 72 #endif // UI_BASE_CLIPBOARD_CLIPBOARD_UTIL_WIN_H_ |
| OLD | NEW |