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

Unified Diff: content/renderer/webclipboard_impl.cc

Issue 206133002: Remove FormatType usage from ClipboardHostMsg_IsFormatAvailable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Win/Mac typo Created 6 years, 9 months 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
Index: content/renderer/webclipboard_impl.cc
diff --git a/content/renderer/webclipboard_impl.cc b/content/renderer/webclipboard_impl.cc
index 4f6e54fc06d68426c5f4c63ca9e00d6d03636501..5ea174900926eab24e4196e9156953e230908605 100644
--- a/content/renderer/webclipboard_impl.cc
+++ b/content/renderer/webclipboard_impl.cc
@@ -8,6 +8,7 @@
#include "base/pickle.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
+#include "content/common/clipboard_message_enums.h"
#include "content/public/common/drop_data.h"
#include "content/renderer/clipboard_utils.h"
#include "content/renderer/drop_data_builder.h"
@@ -57,21 +58,16 @@ bool WebClipboardImpl::isFormatAvailable(Format format, Buffer buffer) {
switch (format) {
case FormatPlainText:
- return client_->IsFormatAvailable(ui::Clipboard::GetPlainTextFormatType(),
- clipboard_type) ||
- client_->IsFormatAvailable(ui::Clipboard::GetPlainTextWFormatType(),
- clipboard_type);
- case FormatHTML:
- return client_->IsFormatAvailable(ui::Clipboard::GetHtmlFormatType(),
+ return client_->IsFormatAvailable(kClipboardFormatPlaintext,
clipboard_type);
+ case FormatHTML:
+ return client_->IsFormatAvailable(kClipboardFormatHTML, clipboard_type);
case FormatSmartPaste:
- return client_->IsFormatAvailable(
- ui::Clipboard::GetWebKitSmartPasteFormatType(), clipboard_type);
+ return client_->IsFormatAvailable(kClipboardFormatSmartPaste,
+ clipboard_type);
case FormatBookmark:
-#if defined(OS_WIN) || defined(OS_MACOSX)
- return client_->IsFormatAvailable(ui::Clipboard::GetUrlWFormatType(),
+ return client_->IsFormatAvailable(kClipboardFormatBookmark,
clipboard_type);
-#endif
default:
NOTREACHED();
}
@@ -94,23 +90,9 @@ WebString WebClipboardImpl::readPlainText(Buffer buffer) {
if (!ConvertBufferType(buffer, &clipboard_type))
return WebString();
- if (client_->IsFormatAvailable(ui::Clipboard::GetPlainTextWFormatType(),
- clipboard_type)) {
- base::string16 text;
- client_->ReadText(clipboard_type, &text);
- if (!text.empty())
- return text;
- }
-
- if (client_->IsFormatAvailable(ui::Clipboard::GetPlainTextFormatType(),
- clipboard_type)) {
- std::string text;
- client_->ReadAsciiText(clipboard_type, &text);
- if (!text.empty())
- return base::ASCIIToUTF16(text);
- }
-
- return WebString();
+ base::string16 text;
+ client_->ReadText(clipboard_type, &text);
+ return text;
}
WebString WebClipboardImpl::readHTML(Buffer buffer, WebURL* source_url,
« content/renderer/clipboard_client.h ('K') | « content/renderer/renderer_clipboard_client.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698