Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4551)

Unified Diff: chrome/common/os_exchange_data.cc

Issue 11247: Remove cf_html from webdropdata.h. This is windows (Closed)
Patch Set: fix feedback Created 12 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/os_exchange_data.h ('k') | chrome/common/os_exchange_data_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/os_exchange_data.cc
diff --git a/chrome/common/os_exchange_data.cc b/chrome/common/os_exchange_data.cc
index 36553c152be0197ac8f8d41cda84203776ea7acd..e86ce33e33488021835b44494cfb64c578566d46 100644
--- a/chrome/common/os_exchange_data.cc
+++ b/chrome/common/os_exchange_data.cc
@@ -335,11 +335,20 @@ void OSExchangeData::SetFileContents(const std::wstring& filename,
ClipboardUtil::GetFileContentFormatZero()->cfFormat, storage));
}
-void OSExchangeData::SetCFHtml(const std::wstring& cf_html) {
- std::string utf8 = WideToUTF8(cf_html);
- STGMEDIUM* storage = GetStorageForBytes(utf8.c_str(), utf8.size());
+void OSExchangeData::SetHtml(const std::wstring& html, const GURL& base_url) {
+ // Add both MS CF_HTML and text/html format. CF_HTML should be in utf-8.
+ std::string utf8_html = WideToUTF8(html);
+ std::string url = base_url.is_valid() ? base_url.spec() : std::string();
+
+ std::string cf_html = ClipboardUtil::HtmlToCFHtml(utf8_html, url);
+ STGMEDIUM* storage = GetStorageForBytes(cf_html.c_str(), cf_html.size());
contents_.push_back(new StoredDataInfo(
ClipboardUtil::GetHtmlFormat()->cfFormat, storage));
+
+ STGMEDIUM* storage_plain = GetStorageForBytes(utf8_html.c_str(),
+ utf8_html.size());
+ contents_.push_back(new StoredDataInfo(
+ ClipboardUtil::GetTextHtmlFormat()->cfFormat, storage_plain));
}
bool OSExchangeData::GetString(std::wstring* data) const {
@@ -395,8 +404,12 @@ bool OSExchangeData::GetFileContents(std::wstring* filename,
file_contents);
}
-bool OSExchangeData::GetCFHtml(std::wstring* cf_html) const {
- return ClipboardUtil::GetCFHtml(source_object_, cf_html);
+bool OSExchangeData::GetHtml(std::wstring* html, GURL* base_url) const {
+ std::string url;
+ bool success = ClipboardUtil::GetHtml(source_object_, html, &url);
+ if (success)
+ *base_url = GURL(url);
+ return success;
}
bool OSExchangeData::HasString() const {
« no previous file with comments | « chrome/common/os_exchange_data.h ('k') | chrome/common/os_exchange_data_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698