summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjaphet@chromium.org <japhet@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-08 22:16:05 +0000
committerjaphet@chromium.org <japhet@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-08 22:16:05 +0000
commit65a6150d49263ff6e3135c5631f9ba5eb12823df (patch)
tree36f5b8624ae02cc69ae29ade9923404f6fec80b3
parent9f53c7d5f1ce83bb2025b1797300c6d60dd7d8ff (diff)
downloadchromium_src-65a6150d49263ff6e3135c5631f9ba5eb12823df.zip
chromium_src-65a6150d49263ff6e3135c5631f9ba5eb12823df.tar.gz
chromium_src-65a6150d49263ff6e3135c5631f9ba5eb12823df.tar.bz2
Roll webkit deps 48155:48185 and remove a couple of passing tests from test_expectations.txt.
Also, merge in http://codereview.chromium.org/174367 (original author: vandebo@chromium.org), which is the downstream half of r48168. BUG=4360 BUG=21228 BUG=18792 TEST=none TBR=eroman git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25669 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--DEPS2
-rw-r--r--base/clipboard.h43
-rw-r--r--base/clipboard_linux.cc63
-rw-r--r--base/clipboard_mac.mm15
-rw-r--r--base/clipboard_unittest.cc55
-rw-r--r--base/clipboard_win.cc18
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit_view_mac.mm8
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit_view_win.cc8
-rw-r--r--chrome/browser/bookmarks/bookmark_utils.cc2
-rw-r--r--chrome/browser/renderer_host/render_view_host.cc7
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view.h4
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_gtk.cc16
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_gtk.h7
-rw-r--r--chrome/browser/renderer_host/resource_message_filter.cc20
-rw-r--r--chrome/browser/renderer_host/resource_message_filter.h15
-rw-r--r--chrome/browser/renderer_host/resource_message_filter_gtk.cc42
-rw-r--r--chrome/common/render_messages.h34
-rw-r--r--chrome/common/render_messages_internal.h20
-rw-r--r--chrome/renderer/render_view.cc12
-rw-r--r--chrome/renderer/render_view.h2
-rw-r--r--chrome/renderer/renderer_glue.cc20
-rw-r--r--views/controls/textfield/native_textfield_win.cc5
-rw-r--r--views/view_unittest.cc12
-rw-r--r--webkit/api/public/WebClipboard.h13
-rw-r--r--webkit/api/public/WebViewClient.h12
-rw-r--r--webkit/api/src/AssertMatchingEnums.cpp3
-rw-r--r--webkit/api/src/ChromiumBridge.cpp19
-rw-r--r--webkit/glue/webclipboard_impl.cc50
-rw-r--r--webkit/glue/webclipboard_impl.h10
-rw-r--r--webkit/glue/webkit_glue.h9
-rw-r--r--webkit/glue/webview_delegate.h8
-rw-r--r--webkit/glue/webview_impl.cc8
-rw-r--r--webkit/tools/layout_tests/test_expectations.txt11
-rw-r--r--webkit/tools/test_shell/mock_webclipboard_impl.cc21
-rw-r--r--webkit/tools/test_shell/mock_webclipboard_impl.h8
-rw-r--r--webkit/tools/test_shell/simple_clipboard_impl.cc17
36 files changed, 389 insertions, 230 deletions
diff --git a/DEPS b/DEPS
index cf74e56..66f6e06 100644
--- a/DEPS
+++ b/DEPS
@@ -1,7 +1,7 @@
vars = {
"webkit_trunk":
"http://svn.webkit.org/repository/webkit/trunk",
- "webkit_revision": "48155",
+ "webkit_revision": "48185",
}
diff --git a/base/clipboard.h b/base/clipboard.h
index bd4aefd..cea5033 100644
--- a/base/clipboard.h
+++ b/base/clipboard.h
@@ -74,6 +74,34 @@ class Clipboard {
typedef std::vector<ObjectMapParam> ObjectMapParams;
typedef std::map<int /* ObjectType */, ObjectMapParams> ObjectMap;
+ // Buffer designates which clipboard the action should be applied to.
+ // Only platforms that use the X Window System support the selection
+ // buffer. Furthermore we currently only use a buffer other than the
+ // standard buffer when reading from the clipboard so only those
+ // functions accept a buffer parameter.
+ enum Buffer {
+ BUFFER_STANDARD,
+#if defined(OS_LINUX)
+ BUFFER_SELECTION,
+#endif
+ };
+
+ static bool IsValidBuffer(int32 buffer) {
+ switch (buffer) {
+ case BUFFER_STANDARD:
+ return true;
+#if defined(OS_LINUX)
+ case BUFFER_SELECTION:
+ return true;
+#endif
+ }
+ return false;
+ }
+
+ static Buffer FromInt(int32 buffer) {
+ return static_cast<Buffer>(buffer);
+ }
+
Clipboard();
~Clipboard();
@@ -90,20 +118,21 @@ class Clipboard {
void WriteObjects(const ObjectMap& objects, base::ProcessHandle process);
// Tests whether the clipboard contains a certain format
- bool IsFormatAvailable(const FormatType& format) const;
+ bool IsFormatAvailable(const FormatType& format, Buffer buffer) const;
// As above, but instead of interpreting |format| by some platform-specific
// definition, interpret it as a literal MIME type.
- bool IsFormatAvailableByString(const std::string& format) const;
+ bool IsFormatAvailableByString(const std::string& format,
+ Buffer buffer) const;
// Reads UNICODE text from the clipboard, if available.
- void ReadText(string16* result) const;
+ void ReadText(Buffer buffer, string16* result) const;
// Reads ASCII text from the clipboard, if available.
- void ReadAsciiText(std::string* result) const;
+ void ReadAsciiText(Buffer buffer, std::string* result) const;
// Reads HTML from the clipboard, if available.
- void ReadHTML(string16* markup, std::string* src_url) const;
+ void ReadHTML(Buffer buffer, string16* markup, std::string* src_url) const;
// Reads a bookmark from the clipboard, if available.
void ReadBookmark(string16* title, std::string* url) const;
@@ -213,8 +242,12 @@ class Clipboard {
// Insert a mapping into clipboard_data_.
void InsertMapping(const char* key, char* data, size_t data_len);
+ // find the gtk clipboard for the passed buffer enum
+ GtkClipboard* LookupBackingClipboard(Buffer clipboard) const;
+
TargetMap* clipboard_data_;
GtkClipboard* clipboard_;
+ GtkClipboard* primary_selection_;
#endif
DISALLOW_COPY_AND_ASSIGN(Clipboard);
diff --git a/base/clipboard_linux.cc b/base/clipboard_linux.cc
index 6aedc91..5d8d353 100644
--- a/base/clipboard_linux.cc
+++ b/base/clipboard_linux.cc
@@ -92,6 +92,7 @@ void GdkPixbufFree(guchar* pixels, gpointer data) {
Clipboard::Clipboard() {
clipboard_ = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
+ primary_selection_ = gtk_clipboard_get(GDK_SELECTION_PRIMARY);
}
Clipboard::~Clipboard() {
@@ -207,18 +208,23 @@ void Clipboard::WriteData(const char* format_name, size_t format_len,
// We do not use gtk_clipboard_wait_is_target_available because of
// a bug with the gtk clipboard. It caches the available targets
// and does not always refresh the cache when it is appropriate.
-bool Clipboard::IsFormatAvailable(const Clipboard::FormatType& format) const {
+bool Clipboard::IsFormatAvailable(const Clipboard::FormatType& format,
+ Clipboard::Buffer buffer) const {
+ GtkClipboard* clipboard = LookupBackingClipboard(buffer);
+ if (clipboard == NULL)
+ return false;
+
bool format_is_plain_text = GetPlainTextFormatType() == format;
if (format_is_plain_text) {
// This tries a number of common text targets.
- if (gtk_clipboard_wait_is_text_available(clipboard_))
+ if (gtk_clipboard_wait_is_text_available(clipboard))
return true;
}
bool retval = false;
GdkAtom* targets = NULL;
GtkSelectionData* data =
- gtk_clipboard_wait_for_contents(clipboard_,
+ gtk_clipboard_wait_for_contents(clipboard,
gdk_atom_intern("TARGETS", false));
if (!data)
@@ -234,7 +240,7 @@ bool Clipboard::IsFormatAvailable(const Clipboard::FormatType& format) const {
// programs.
if (num <= 0) {
if (format_is_plain_text) {
- gchar* text = gtk_clipboard_wait_for_text(clipboard_);
+ gchar* text = gtk_clipboard_wait_for_text(clipboard);
if (text) {
g_free(text);
retval = true;
@@ -257,13 +263,18 @@ bool Clipboard::IsFormatAvailable(const Clipboard::FormatType& format) const {
return retval;
}
-bool Clipboard::IsFormatAvailableByString(const std::string& format) const {
- return IsFormatAvailable(format);
+bool Clipboard::IsFormatAvailableByString(const std::string& format,
+ Clipboard::Buffer buffer) const {
+ return IsFormatAvailable(format, buffer);
}
-void Clipboard::ReadText(string16* result) const {
+void Clipboard::ReadText(Clipboard::Buffer buffer, string16* result) const {
+ GtkClipboard* clipboard = LookupBackingClipboard(buffer);
+ if (clipboard == NULL)
+ return;
+
result->clear();
- gchar* text = gtk_clipboard_wait_for_text(clipboard_);
+ gchar* text = gtk_clipboard_wait_for_text(clipboard);
if (text == NULL)
return;
@@ -273,9 +284,14 @@ void Clipboard::ReadText(string16* result) const {
g_free(text);
}
-void Clipboard::ReadAsciiText(std::string* result) const {
+void Clipboard::ReadAsciiText(Clipboard::Buffer buffer,
+ std::string* result) const {
+ GtkClipboard* clipboard = LookupBackingClipboard(buffer);
+ if (clipboard == NULL)
+ return;
+
result->clear();
- gchar* text = gtk_clipboard_wait_for_text(clipboard_);
+ gchar* text = gtk_clipboard_wait_for_text(clipboard);
if (text == NULL)
return;
@@ -290,10 +306,14 @@ void Clipboard::ReadFile(FilePath* file) const {
// TODO(estade): handle different charsets.
// TODO(port): set *src_url.
-void Clipboard::ReadHTML(string16* markup, std::string* src_url) const {
+void Clipboard::ReadHTML(Clipboard::Buffer buffer, string16* markup,
+ std::string* src_url) const {
+ GtkClipboard* clipboard = LookupBackingClipboard(buffer);
+ if (clipboard == NULL)
+ return;
markup->clear();
- GtkSelectionData* data = gtk_clipboard_wait_for_contents(clipboard_,
+ GtkSelectionData* data = gtk_clipboard_wait_for_contents(clipboard,
StringToGdkAtom(GetHtmlFormatType()));
if (!data)
@@ -355,3 +375,22 @@ void Clipboard::InsertMapping(const char* key,
(*clipboard_data_)[key] = std::make_pair(data, data_len);
}
+
+GtkClipboard* Clipboard::LookupBackingClipboard(Buffer clipboard) const {
+ GtkClipboard* result;
+
+ switch (clipboard) {
+ case BUFFER_STANDARD:
+ result = clipboard_;
+ break;
+ case BUFFER_SELECTION:
+ result = primary_selection_;
+ break;
+ default:
+ NOTREACHED();
+ result = NULL;
+ break;
+ }
+ return result;
+}
+
diff --git a/base/clipboard_mac.mm b/base/clipboard_mac.mm
index 889655f..98812f3 100644
--- a/base/clipboard_mac.mm
+++ b/base/clipboard_mac.mm
@@ -135,7 +135,9 @@ void Clipboard::WriteWebSmartPaste() {
[pb setData:nil forType:format];
}
-bool Clipboard::IsFormatAvailable(const Clipboard::FormatType& format) const {
+bool Clipboard::IsFormatAvailable(const Clipboard::FormatType& format,
+ Clipboard::Buffer buffer) const {
+ DCHECK_EQ(buffer, BUFFER_STANDARD);
NSString* format_ns = base::SysUTF8ToNSString(format);
NSPasteboard* pb = GetPasteboard();
@@ -144,7 +146,8 @@ bool Clipboard::IsFormatAvailable(const Clipboard::FormatType& format) const {
return [types containsObject:format_ns];
}
-void Clipboard::ReadText(string16* result) const {
+void Clipboard::ReadText(Clipboard::Buffer buffer, string16* result) const {
+ DCHECK_EQ(buffer, BUFFER_STANDARD);
NSPasteboard* pb = GetPasteboard();
NSString* contents = [pb stringForType:NSStringPboardType];
@@ -153,7 +156,9 @@ void Clipboard::ReadText(string16* result) const {
result);
}
-void Clipboard::ReadAsciiText(std::string* result) const {
+void Clipboard::ReadAsciiText(Clipboard::Buffer buffer,
+ std::string* result) const {
+ DCHECK_EQ(buffer, BUFFER_STANDARD);
NSPasteboard* pb = GetPasteboard();
NSString* contents = [pb stringForType:NSStringPboardType];
@@ -163,7 +168,9 @@ void Clipboard::ReadAsciiText(std::string* result) const {
result->assign([contents UTF8String]);
}
-void Clipboard::ReadHTML(string16* markup, std::string* src_url) const {
+void Clipboard::ReadHTML(Clipboard::Buffer buffer, string16* markup,
+ std::string* src_url) const {
+ DCHECK_EQ(buffer, BUFFER_STANDARD);
if (markup) {
NSPasteboard* pb = GetPasteboard();
NSArray *supportedTypes = [NSArray arrayWithObjects:NSHTMLPboardType,
diff --git a/base/clipboard_unittest.cc b/base/clipboard_unittest.cc
index dbcaa44..1b77115 100644
--- a/base/clipboard_unittest.cc
+++ b/base/clipboard_unittest.cc
@@ -44,9 +44,9 @@ TEST_F(ClipboardTest, ClearTest) {
}
EXPECT_FALSE(clipboard.IsFormatAvailable(
- Clipboard::GetPlainTextWFormatType()));
+ Clipboard::GetPlainTextWFormatType(), Clipboard::BUFFER_STANDARD));
EXPECT_FALSE(clipboard.IsFormatAvailable(
- Clipboard::GetPlainTextFormatType()));
+ Clipboard::GetPlainTextFormatType(), Clipboard::BUFFER_STANDARD));
}
TEST_F(ClipboardTest, TextTest) {
@@ -61,12 +61,13 @@ TEST_F(ClipboardTest, TextTest) {
}
EXPECT_TRUE(clipboard.IsFormatAvailable(
- Clipboard::GetPlainTextWFormatType()));
- EXPECT_TRUE(clipboard.IsFormatAvailable(Clipboard::GetPlainTextFormatType()));
- clipboard.ReadText(&text_result);
+ Clipboard::GetPlainTextWFormatType(), Clipboard::BUFFER_STANDARD));
+ EXPECT_TRUE(clipboard.IsFormatAvailable(Clipboard::GetPlainTextFormatType(),
+ Clipboard::BUFFER_STANDARD));
+ clipboard.ReadText(Clipboard::BUFFER_STANDARD, &text_result);
EXPECT_EQ(text, text_result);
- clipboard.ReadAsciiText(&ascii_text);
+ clipboard.ReadAsciiText(Clipboard::BUFFER_STANDARD, &ascii_text);
EXPECT_EQ(UTF16ToUTF8(text), ascii_text);
}
@@ -81,8 +82,9 @@ TEST_F(ClipboardTest, HTMLTest) {
clipboard_writer.WriteHTML(markup, url);
}
- EXPECT_TRUE(clipboard.IsFormatAvailable(Clipboard::GetHtmlFormatType()));
- clipboard.ReadHTML(&markup_result, &url_result);
+ EXPECT_TRUE(clipboard.IsFormatAvailable(Clipboard::GetHtmlFormatType(),
+ Clipboard::BUFFER_STANDARD));
+ clipboard.ReadHTML(Clipboard::BUFFER_STANDARD, &markup_result, &url_result);
EXPECT_EQ(markup, markup_result);
#if defined(OS_WIN)
// TODO(playmobil): It's not clear that non windows clipboards need to support
@@ -103,8 +105,9 @@ TEST_F(ClipboardTest, TrickyHTMLTest) {
clipboard_writer.WriteHTML(markup, url);
}
- EXPECT_TRUE(clipboard.IsFormatAvailable(Clipboard::GetHtmlFormatType()));
- clipboard.ReadHTML(&markup_result, &url_result);
+ EXPECT_TRUE(clipboard.IsFormatAvailable(Clipboard::GetHtmlFormatType(),
+ Clipboard::BUFFER_STANDARD));
+ clipboard.ReadHTML(Clipboard::BUFFER_STANDARD, &markup_result, &url_result);
EXPECT_EQ(markup, markup_result);
#if defined(OS_WIN)
// TODO(playmobil): It's not clear that non windows clipboards need to support
@@ -126,7 +129,8 @@ TEST_F(ClipboardTest, BookmarkTest) {
clipboard_writer.WriteBookmark(title, url);
}
- EXPECT_TRUE(clipboard.IsFormatAvailable(Clipboard::GetUrlWFormatType()));
+ EXPECT_TRUE(clipboard.IsFormatAvailable(Clipboard::GetUrlWFormatType(),
+ Clipboard::BUFFER_STANDARD));
clipboard.ReadBookmark(&title_result, &url_result);
EXPECT_EQ(title, title_result);
EXPECT_EQ(url, url_result);
@@ -147,21 +151,22 @@ TEST_F(ClipboardTest, MultiFormatTest) {
clipboard_writer.WriteText(text);
}
- EXPECT_TRUE(clipboard.IsFormatAvailable(Clipboard::GetHtmlFormatType()));
+ EXPECT_TRUE(clipboard.IsFormatAvailable(Clipboard::GetHtmlFormatType(),
+ Clipboard::BUFFER_STANDARD));
EXPECT_TRUE(clipboard.IsFormatAvailable(
- Clipboard::GetPlainTextWFormatType()));
+ Clipboard::GetPlainTextWFormatType(), Clipboard::BUFFER_STANDARD));
EXPECT_TRUE(clipboard.IsFormatAvailable(
- Clipboard::GetPlainTextFormatType()));
- clipboard.ReadHTML(&markup_result, &url_result);
+ Clipboard::GetPlainTextFormatType(), Clipboard::BUFFER_STANDARD));
+ clipboard.ReadHTML(Clipboard::BUFFER_STANDARD, &markup_result, &url_result);
EXPECT_EQ(markup, markup_result);
#if defined(OS_WIN)
// TODO(playmobil): It's not clear that non windows clipboards need to support
// this.
EXPECT_EQ(url, url_result);
#endif // defined(OS_WIN)
- clipboard.ReadText(&text_result);
+ clipboard.ReadText(Clipboard::BUFFER_STANDARD, &text_result);
EXPECT_EQ(text, text_result);
- clipboard.ReadAsciiText(&ascii_text);
+ clipboard.ReadAsciiText(Clipboard::BUFFER_STANDARD, &ascii_text);
EXPECT_EQ(UTF16ToUTF8(text), ascii_text);
}
@@ -235,7 +240,8 @@ TEST_F(ClipboardTest, DataTest) {
clipboard_writer.WritePickledData(write_pickle, format);
}
- ASSERT_TRUE(clipboard.IsFormatAvailableByString(format));
+ ASSERT_TRUE(clipboard.IsFormatAvailableByString(
+ format, Clipboard::BUFFER_STANDARD));
std::string output;
clipboard.ReadData(format, &output);
ASSERT_FALSE(output.empty());
@@ -262,12 +268,14 @@ TEST_F(ClipboardTest, HyperlinkTest) {
clipboard_writer.WriteHyperlink(title, url);
}
- EXPECT_TRUE(clipboard.IsFormatAvailable(Clipboard::GetUrlWFormatType()));
- EXPECT_TRUE(clipboard.IsFormatAvailable(Clipboard::GetHtmlFormatType()));
+ EXPECT_TRUE(clipboard.IsFormatAvailable(Clipboard::GetUrlWFormatType(),
+ Clipboard::BUFFER_STANDARD));
+ EXPECT_TRUE(clipboard.IsFormatAvailable(Clipboard::GetHtmlFormatType(),
+ Clipboard::BUFFER_STANDARD));
clipboard.ReadBookmark(&title_result, &url_result);
EXPECT_EQ(title, title_result);
EXPECT_EQ(url, url_result);
- clipboard.ReadHTML(&html_result, &url_result);
+ clipboard.ReadHTML(Clipboard::BUFFER_STANDARD, &html_result, &url_result);
EXPECT_EQ(html, html_result);
}
@@ -280,7 +288,7 @@ TEST_F(ClipboardTest, WebSmartPasteTest) {
}
EXPECT_TRUE(clipboard.IsFormatAvailable(
- Clipboard::GetWebKitSmartPasteFormatType()));
+ Clipboard::GetWebKitSmartPasteFormatType(), Clipboard::BUFFER_STANDARD));
}
TEST_F(ClipboardTest, BitmapTest) {
@@ -297,6 +305,7 @@ TEST_F(ClipboardTest, BitmapTest) {
clipboard_writer.WriteBitmapFromPixels(fake_bitmap, gfx::Size(3, 4));
}
- EXPECT_TRUE(clipboard.IsFormatAvailable(Clipboard::GetBitmapFormatType()));
+ EXPECT_TRUE(clipboard.IsFormatAvailable(Clipboard::GetBitmapFormatType(),
+ Clipboard::BUFFER_STANDARD));
}
#endif // defined(OS_WIN)
diff --git a/base/clipboard_win.cc b/base/clipboard_win.cc
index bd88efa..5b190af 100644
--- a/base/clipboard_win.cc
+++ b/base/clipboard_win.cc
@@ -397,18 +397,22 @@ void Clipboard::WriteToClipboard(unsigned int format, HANDLE handle) {
}
}
-bool Clipboard::IsFormatAvailable(const Clipboard::FormatType& format) const {
+bool Clipboard::IsFormatAvailable(const Clipboard::FormatType& format,
+ Clipboard::Buffer buffer) const {
+ DCHECK_EQ(buffer, BUFFER_STANDARD);
return ::IsClipboardFormatAvailable(StringToInt(format)) != FALSE;
}
bool Clipboard::IsFormatAvailableByString(
- const std::string& ascii_format) const {
+ const std::string& ascii_format, Clipboard::Buffer buffer) const {
+ DCHECK_EQ(buffer, BUFFER_STANDARD);
std::wstring wide_format = ASCIIToWide(ascii_format);
CLIPFORMAT format = ::RegisterClipboardFormat(wide_format.c_str());
return ::IsClipboardFormatAvailable(format) != FALSE;
}
-void Clipboard::ReadText(string16* result) const {
+void Clipboard::ReadText(Clipboard::Buffer buffer, string16* result) const {
+ DCHECK_EQ(buffer, BUFFER_STANDARD);
if (!result) {
NOTREACHED();
return;
@@ -429,7 +433,9 @@ void Clipboard::ReadText(string16* result) const {
::GlobalUnlock(data);
}
-void Clipboard::ReadAsciiText(std::string* result) const {
+void Clipboard::ReadAsciiText(Clipboard::Buffer buffer,
+ std::string* result) const {
+ DCHECK_EQ(buffer, BUFFER_STANDARD);
if (!result) {
NOTREACHED();
return;
@@ -450,7 +456,9 @@ void Clipboard::ReadAsciiText(std::string* result) const {
::GlobalUnlock(data);
}
-void Clipboard::ReadHTML(string16* markup, std::string* src_url) const {
+void Clipboard::ReadHTML(Clipboard::Buffer buffer, string16* markup,
+ std::string* src_url) const {
+ DCHECK_EQ(buffer, BUFFER_STANDARD);
if (markup)
markup->clear();
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm b/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm
index 83b6214..94a9af6 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm
@@ -661,9 +661,10 @@ std::wstring AutocompleteEditViewMac::GetClipboardText(Clipboard* clipboard) {
// will too.
DCHECK(clipboard);
- if (clipboard->IsFormatAvailable(Clipboard::GetPlainTextWFormatType())) {
+ if (clipboard->IsFormatAvailable(Clipboard::GetPlainTextWFormatType(),
+ Clipboard::BUFFER_STANDARD)) {
string16 text16;
- clipboard->ReadText(&text16);
+ clipboard->ReadText(Clipboard::BUFFER_STANDARD, &text16);
// Note: Unlike in the find popup and textfield view, here we completely
// remove whitespace strings containing newlines. We assume users are
@@ -681,7 +682,8 @@ std::wstring AutocompleteEditViewMac::GetClipboardText(Clipboard* clipboard) {
// and pastes from the URL bar to itself, the text will get fixed up and
// cannonicalized, which is not what the user expects. By pasting in this
// order, we are sure to paste what the user copied.
- if (clipboard->IsFormatAvailable(Clipboard::GetUrlWFormatType())) {
+ if (clipboard->IsFormatAvailable(Clipboard::GetUrlWFormatType(),
+ Clipboard::BUFFER_STANDARD)) {
std::string url_str;
clipboard->ReadBookmark(NULL, &url_str);
// pass resulting url string through GURL to normalize
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_win.cc b/chrome/browser/autocomplete/autocomplete_edit_view_win.cc
index 5fe2ba0..3347a34 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_win.cc
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_win.cc
@@ -2180,9 +2180,10 @@ void AutocompleteEditViewWin::TextChanged() {
std::wstring AutocompleteEditViewWin::GetClipboardText() const {
// Try text format.
Clipboard* clipboard = g_browser_process->clipboard();
- if (clipboard->IsFormatAvailable(Clipboard::GetPlainTextWFormatType())) {
+ if (clipboard->IsFormatAvailable(Clipboard::GetPlainTextWFormatType(),
+ Clipboard::BUFFER_STANDARD)) {
std::wstring text;
- clipboard->ReadText(&text);
+ clipboard->ReadText(Clipboard::BUFFER_STANDARD, &text);
// Note: Unlike in the find popup and textfield view, here we completely
// remove whitespace strings containing newlines. We assume users are
@@ -2200,7 +2201,8 @@ std::wstring AutocompleteEditViewWin::GetClipboardText() const {
// and pastes from the URL bar to itself, the text will get fixed up and
// cannonicalized, which is not what the user expects. By pasting in this
// order, we are sure to paste what the user copied.
- if (clipboard->IsFormatAvailable(Clipboard::GetUrlWFormatType())) {
+ if (clipboard->IsFormatAvailable(Clipboard::GetUrlWFormatType(),
+ Clipboard::BUFFER_STANDARD)) {
std::string url_str;
clipboard->ReadBookmark(NULL, &url_str);
// pass resulting url string through GURL to normalize
diff --git a/chrome/browser/bookmarks/bookmark_utils.cc b/chrome/browser/bookmarks/bookmark_utils.cc
index 51250c3..25daf35 100644
--- a/chrome/browser/bookmarks/bookmark_utils.cc
+++ b/chrome/browser/bookmarks/bookmark_utils.cc
@@ -392,7 +392,7 @@ bool CanPasteFromClipboard(const BookmarkNode* node) {
return false;
return g_browser_process->clipboard()->IsFormatAvailable(
- BookmarkDragData::kClipboardFormatString);
+ BookmarkDragData::kClipboardFormatString, Clipboard::BUFFER_STANDARD);
}
std::string GetNameForURL(const GURL& url) {
diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc
index 066d1cc..9085996 100644
--- a/chrome/browser/renderer_host/render_view_host.cc
+++ b/chrome/browser/renderer_host/render_view_host.cc
@@ -825,8 +825,6 @@ void RenderViewHost::OnMessageReceived(const IPC::Message& msg) {
OnRemoveAutofillEntry)
IPC_MESSAGE_HANDLER(ViewHostMsg_ExtensionRequest, OnExtensionRequest)
IPC_MESSAGE_HANDLER(ViewHostMsg_SelectionChanged, OnMsgSelectionChanged)
- IPC_MESSAGE_HANDLER(ViewHostMsg_PasteFromSelectionClipboard,
- OnMsgPasteFromSelectionClipboard)
IPC_MESSAGE_HANDLER(ViewHostMsg_ExtensionPostMessage,
OnExtensionPostMessage)
IPC_MESSAGE_HANDLER(ViewHostMsg_AccessibilityFocusChange,
@@ -1262,11 +1260,6 @@ void RenderViewHost::OnMsgSelectionChanged(const std::string& text) {
view()->SelectionChanged(text);
}
-void RenderViewHost::OnMsgPasteFromSelectionClipboard() {
- if (view())
- view()->PasteFromSelectionClipboard();
-}
-
void RenderViewHost::OnMsgRunFileChooser(bool multiple_files,
const string16& title,
const FilePath& default_file) {
diff --git a/chrome/browser/renderer_host/render_widget_host_view.h b/chrome/browser/renderer_host/render_widget_host_view.h
index 508be27..05f3f6d 100644
--- a/chrome/browser/renderer_host/render_widget_host_view.h
+++ b/chrome/browser/renderer_host/render_widget_host_view.h
@@ -132,10 +132,6 @@ class RenderWidgetHostView {
// Notifies the View that the renderer text selection has changed.
virtual void SelectionChanged(const std::string& text) { };
- // Tells the View to get the text from the selection clipboard and send it
- // back to the renderer asynchronously.
- virtual void PasteFromSelectionClipboard() { }
-
// Tells the View whether the context menu is showing. This is used on Linux
// to suppress updates to webkit focus for the duration of the show.
virtual void ShowingContextMenu(bool showing) { }
diff --git a/chrome/browser/renderer_host/render_widget_host_view_gtk.cc b/chrome/browser/renderer_host/render_widget_host_view_gtk.cc
index ec6be0f..460d4f7 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_gtk.cc
+++ b/chrome/browser/renderer_host/render_widget_host_view_gtk.cc
@@ -524,11 +524,6 @@ void RenderWidgetHostViewGtk::SelectionChanged(const std::string& text) {
gtk_clipboard_set_text(x_clipboard, text.c_str(), text.length());
}
-void RenderWidgetHostViewGtk::PasteFromSelectionClipboard() {
- GtkClipboard* x_clipboard = gtk_clipboard_get(GDK_SELECTION_PRIMARY);
- gtk_clipboard_request_text(x_clipboard, ReceivedSelectionText, this);
-}
-
void RenderWidgetHostViewGtk::ShowingContextMenu(bool showing) {
is_showing_context_menu_ = showing;
}
@@ -614,17 +609,6 @@ void RenderWidgetHostViewGtk::ShowCurrentCursor() {
gdk_cursor_unref(gdk_cursor);
}
-void RenderWidgetHostViewGtk::ReceivedSelectionText(GtkClipboard* clipboard,
- const gchar* text, gpointer userdata) {
- // If there's nothing to paste (|text| is NULL), do nothing.
- if (!text)
- return;
- RenderWidgetHostViewGtk* host_view =
- reinterpret_cast<RenderWidgetHostViewGtk*>(userdata);
- host_view->host_->Send(new ViewMsg_InsertText(host_view->host_->routing_id(),
- UTF8ToUTF16(text)));
-}
-
void RenderWidgetHostViewGtk::CreatePluginContainer(
gfx::PluginWindowHandle id) {
plugin_container_manager_.CreatePluginContainer(id);
diff --git a/chrome/browser/renderer_host/render_widget_host_view_gtk.h b/chrome/browser/renderer_host/render_widget_host_view_gtk.h
index 9f5c76d..c0e3d6f 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_gtk.h
+++ b/chrome/browser/renderer_host/render_widget_host_view_gtk.h
@@ -61,7 +61,6 @@ class RenderWidgetHostViewGtk : public RenderWidgetHostView {
virtual void Destroy();
virtual void SetTooltipText(const std::wstring& tooltip_text);
virtual void SelectionChanged(const std::string& text);
- virtual void PasteFromSelectionClipboard();
virtual void ShowingContextMenu(bool showing);
virtual BackingStore* AllocBackingStore(const gfx::Size& size);
virtual void SetBackground(const SkBitmap& background);
@@ -78,12 +77,6 @@ class RenderWidgetHostViewGtk : public RenderWidgetHostView {
// Update the display cursor for the render view.
void ShowCurrentCursor();
- // When we've requested the text from the X clipboard, GTK returns it to us
- // through this callback.
- static void ReceivedSelectionText(GtkClipboard* clipboard,
- const gchar* text,
- gpointer userdata);
-
// The model object.
RenderWidgetHost* const host_;
diff --git a/chrome/browser/renderer_host/resource_message_filter.cc b/chrome/browser/renderer_host/resource_message_filter.cc
index ed4a525..5a21f34 100644
--- a/chrome/browser/renderer_host/resource_message_filter.cc
+++ b/chrome/browser/renderer_host/resource_message_filter.cc
@@ -625,30 +625,34 @@ void ResourceMessageFilter::OnClipboardWriteObjects(
// functions.
void ResourceMessageFilter::OnClipboardIsFormatAvailable(
- Clipboard::FormatType format, IPC::Message* reply) {
- const bool result = GetClipboard()->IsFormatAvailable(format);
+ Clipboard::FormatType format, Clipboard::Buffer buffer,
+ IPC::Message* reply) {
+ const bool result = GetClipboard()->IsFormatAvailable(format, buffer);
ViewHostMsg_ClipboardIsFormatAvailable::WriteReplyParams(reply, result);
Send(reply);
}
-void ResourceMessageFilter::OnClipboardReadText(IPC::Message* reply) {
+void ResourceMessageFilter::OnClipboardReadText(Clipboard::Buffer buffer,
+ IPC::Message* reply) {
string16 result;
- GetClipboard()->ReadText(&result);
+ GetClipboard()->ReadText(buffer, &result);
ViewHostMsg_ClipboardReadText::WriteReplyParams(reply, result);
Send(reply);
}
-void ResourceMessageFilter::OnClipboardReadAsciiText(IPC::Message* reply) {
+void ResourceMessageFilter::OnClipboardReadAsciiText(Clipboard::Buffer buffer,
+ IPC::Message* reply) {
std::string result;
- GetClipboard()->ReadAsciiText(&result);
+ GetClipboard()->ReadAsciiText(buffer, &result);
ViewHostMsg_ClipboardReadAsciiText::WriteReplyParams(reply, result);
Send(reply);
}
-void ResourceMessageFilter::OnClipboardReadHTML(IPC::Message* reply) {
+void ResourceMessageFilter::OnClipboardReadHTML(Clipboard::Buffer buffer,
+ IPC::Message* reply) {
std::string src_url_str;
string16 markup;
- GetClipboard()->ReadHTML(&markup, &src_url_str);
+ GetClipboard()->ReadHTML(buffer, &markup, &src_url_str);
const GURL src_url = GURL(src_url_str);
ViewHostMsg_ClipboardReadHTML::WriteReplyParams(reply, markup, src_url);
diff --git a/chrome/browser/renderer_host/resource_message_filter.h b/chrome/browser/renderer_host/resource_message_filter.h
index feb1e54..4c467c6 100644
--- a/chrome/browser/renderer_host/resource_message_filter.h
+++ b/chrome/browser/renderer_host/resource_message_filter.h
@@ -171,10 +171,11 @@ class ResourceMessageFilter : public IPC::ChannelProxy::MessageFilter,
void OnClipboardWriteObjects(const Clipboard::ObjectMap& objects);
void OnClipboardIsFormatAvailable(Clipboard::FormatType format,
+ Clipboard::Buffer buffer,
IPC::Message* reply);
- void OnClipboardReadText(IPC::Message* reply);
- void OnClipboardReadAsciiText(IPC::Message* reply);
- void OnClipboardReadHTML(IPC::Message* reply);
+ void OnClipboardReadText(Clipboard::Buffer buffer, IPC::Message* reply);
+ void OnClipboardReadAsciiText(Clipboard::Buffer buffer, IPC::Message* reply);
+ void OnClipboardReadHTML(Clipboard::Buffer buffer, IPC::Message* reply);
#if !defined(OS_MACOSX)
// Not handled in the IO thread on Mac.
@@ -252,10 +253,12 @@ class ResourceMessageFilter : public IPC::ChannelProxy::MessageFilter,
void DoOnGetWindowRect(gfx::NativeViewId view, IPC::Message* reply_msg);
void DoOnGetRootWindowRect(gfx::NativeViewId view, IPC::Message* reply_msg);
void DoOnClipboardIsFormatAvailable(Clipboard::FormatType format,
+ Clipboard::Buffer buffer,
IPC::Message* reply_msg);
- void DoOnClipboardReadText(IPC::Message* reply_msg);
- void DoOnClipboardReadAsciiText(IPC::Message* reply_msg);
- void DoOnClipboardReadHTML(IPC::Message* reply_msg);
+ void DoOnClipboardReadText(Clipboard::Buffer buffer, IPC::Message* reply_msg);
+ void DoOnClipboardReadAsciiText(Clipboard::Buffer buffer,
+ IPC::Message* reply_msg);
+ void DoOnClipboardReadHTML(Clipboard::Buffer buffer, IPC::Message* reply_msg);
#endif
bool CheckBenchmarkingEnabled();
diff --git a/chrome/browser/renderer_host/resource_message_filter_gtk.cc b/chrome/browser/renderer_host/resource_message_filter_gtk.cc
index 052713c..1dd964d 100644
--- a/chrome/browser/renderer_host/resource_message_filter_gtk.cc
+++ b/chrome/browser/renderer_host/resource_message_filter_gtk.cc
@@ -102,8 +102,9 @@ void ResourceMessageFilter::DoOnGetRootWindowRect(gfx::NativeViewId view,
// Called on the UI thread.
void ResourceMessageFilter::DoOnClipboardIsFormatAvailable(
- Clipboard::FormatType format, IPC::Message* reply_msg) {
- const bool result = GetClipboard()->IsFormatAvailable(format);
+ Clipboard::FormatType format, Clipboard::Buffer buffer,
+ IPC::Message* reply_msg) {
+ const bool result = GetClipboard()->IsFormatAvailable(format, buffer);
ViewHostMsg_ClipboardIsFormatAvailable::WriteReplyParams(reply_msg, result);
@@ -113,9 +114,10 @@ void ResourceMessageFilter::DoOnClipboardIsFormatAvailable(
}
// Called on the UI thread.
-void ResourceMessageFilter::DoOnClipboardReadText(IPC::Message* reply_msg) {
+void ResourceMessageFilter::DoOnClipboardReadText(Clipboard::Buffer buffer,
+ IPC::Message* reply_msg) {
string16 result;
- GetClipboard()->ReadText(&result);
+ GetClipboard()->ReadText(buffer, &result);
ViewHostMsg_ClipboardReadText::WriteReplyParams(reply_msg, result);
@@ -126,9 +128,9 @@ void ResourceMessageFilter::DoOnClipboardReadText(IPC::Message* reply_msg) {
// Called on the UI thread.
void ResourceMessageFilter::DoOnClipboardReadAsciiText(
- IPC::Message* reply_msg) {
+ Clipboard::Buffer buffer, IPC::Message* reply_msg) {
std::string result;
- GetClipboard()->ReadAsciiText(&result);
+ GetClipboard()->ReadAsciiText(buffer, &result);
ViewHostMsg_ClipboardReadAsciiText::WriteReplyParams(reply_msg, result);
@@ -138,10 +140,11 @@ void ResourceMessageFilter::DoOnClipboardReadAsciiText(
}
// Called on the UI thread.
-void ResourceMessageFilter::DoOnClipboardReadHTML(IPC::Message* reply_msg) {
+void ResourceMessageFilter::DoOnClipboardReadHTML(Clipboard::Buffer buffer,
+ IPC::Message* reply_msg) {
std::string src_url_str;
string16 markup;
- GetClipboard()->ReadHTML(&markup, &src_url_str);
+ GetClipboard()->ReadHTML(buffer, &markup, &src_url_str);
const GURL src_url = GURL(src_url_str);
ViewHostMsg_ClipboardReadHTML::WriteReplyParams(reply_msg, markup, src_url);
@@ -177,26 +180,33 @@ void ResourceMessageFilter::OnGetRootWindowRect(gfx::NativeViewId view,
// Called on the IO thread.
void ResourceMessageFilter::OnClipboardIsFormatAvailable(
- Clipboard::FormatType format, IPC::Message* reply_msg) {
+ Clipboard::FormatType format, Clipboard::Buffer buffer,
+ IPC::Message* reply_msg) {
ui_loop()->PostTask(FROM_HERE, NewRunnableMethod(
this, &ResourceMessageFilter::DoOnClipboardIsFormatAvailable, format,
- reply_msg));
+ buffer, reply_msg));
}
// Called on the IO thread.
-void ResourceMessageFilter::OnClipboardReadText(IPC::Message* reply_msg) {
+void ResourceMessageFilter::OnClipboardReadText(Clipboard::Buffer buffer,
+ IPC::Message* reply_msg) {
ui_loop()->PostTask(FROM_HERE, NewRunnableMethod(
- this, &ResourceMessageFilter::DoOnClipboardReadText, reply_msg));
+ this, &ResourceMessageFilter::DoOnClipboardReadText, buffer,
+ reply_msg));
}
// Called on the IO thread.
-void ResourceMessageFilter::OnClipboardReadAsciiText(IPC::Message* reply_msg) {
+void ResourceMessageFilter::OnClipboardReadAsciiText(Clipboard::Buffer buffer,
+ IPC::Message* reply_msg) {
ui_loop()->PostTask(FROM_HERE, NewRunnableMethod(
- this, &ResourceMessageFilter::DoOnClipboardReadAsciiText, reply_msg));
+ this, &ResourceMessageFilter::DoOnClipboardReadAsciiText, buffer,
+ reply_msg));
}
// Called on the IO thread.
-void ResourceMessageFilter::OnClipboardReadHTML(IPC::Message* reply_msg) {
+void ResourceMessageFilter::OnClipboardReadHTML(Clipboard::Buffer buffer,
+ IPC::Message* reply_msg) {
ui_loop()->PostTask(FROM_HERE, NewRunnableMethod(
- this, &ResourceMessageFilter::DoOnClipboardReadHTML, reply_msg));
+ this, &ResourceMessageFilter::DoOnClipboardReadHTML, buffer,
+ reply_msg));
}
diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h
index adfffed..e06838b 100644
--- a/chrome/common/render_messages.h
+++ b/chrome/common/render_messages.h
@@ -10,6 +10,7 @@
#include <map>
#include "base/basictypes.h"
+#include "base/clipboard.h"
#include "base/gfx/native_widget_types.h"
#include "base/ref_counted.h"
#include "base/shared_memory.h"
@@ -2186,6 +2187,39 @@ struct ParamTraits<URLPattern> {
}
};
+template <>
+struct ParamTraits<Clipboard::Buffer> {
+ typedef Clipboard::Buffer param_type;
+ static void Write(Message* m, const param_type& p) {
+ m->WriteInt(p);
+ }
+ static bool Read(const Message* m, void** iter, param_type* p) {
+ int buffer;
+ if (!m->ReadInt(iter, &buffer) || !Clipboard::IsValidBuffer(buffer))
+ return false;
+ *p = Clipboard::FromInt(buffer);
+ return true;
+ }
+ static void Log(const param_type& p, std::wstring* l) {
+ std::wstring type;
+ switch (p) {
+ case Clipboard::BUFFER_STANDARD:
+ type = L"BUFFER_STANDARD";
+ break;
+#if defined(OS_LINUX)
+ case Clipboard::BUFFER_SELECTION:
+ type = L"BUFFER_SELECTION";
+ break;
+#endif
+ default:
+ type = L"UNKNOWN";
+ break;
+ }
+
+ LogParam(type, l);
+ }
+};
+
} // namespace IPC
diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h
index aad21c2..22f273d 100644
--- a/chrome/common/render_messages_internal.h
+++ b/chrome/common/render_messages_internal.h
@@ -309,10 +309,6 @@ IPC_BEGIN_MESSAGES(View)
IPC_MESSAGE_ROUTED1(ViewMsg_Zoom,
int /* One of PageZoom::Function */)
- // Insert text in the currently focused input area.
- IPC_MESSAGE_ROUTED1(ViewMsg_InsertText,
- string16 /* text */)
-
// Change encoding of page in the renderer.
IPC_MESSAGE_ROUTED1(ViewMsg_SetPageEncoding,
std::string /*new encoding name*/)
@@ -975,10 +971,6 @@ IPC_BEGIN_MESSAGES(ViewHost)
int32 /* page_id */,
GURL /* url of the favicon */)
- // Request that the browser get the text from the selection clipboard and send
- // it back to the renderer via ViewMsg_SelectionClipboardResponse.
- IPC_MESSAGE_ROUTED0(ViewHostMsg_PasteFromSelectionClipboard)
-
// Used to tell the parent that the user right clicked on an area of the
// content area, and a context menu should be shown for it. The params
// object contains information about the node(s) that were selected when the
@@ -1050,14 +1042,18 @@ IPC_BEGIN_MESSAGES(ViewHost)
// free the shared memory used to transfer the bitmap.
IPC_SYNC_MESSAGE_CONTROL1_0(ViewHostMsg_ClipboardWriteObjectsSync,
Clipboard::ObjectMap /* objects */)
- IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_ClipboardIsFormatAvailable,
+ IPC_SYNC_MESSAGE_CONTROL2_1(ViewHostMsg_ClipboardIsFormatAvailable,
std::string /* format */,
+ Clipboard::Buffer /* buffer */,
bool /* result */)
- IPC_SYNC_MESSAGE_CONTROL0_1(ViewHostMsg_ClipboardReadText,
+ IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_ClipboardReadText,
+ Clipboard::Buffer /* buffer */,
string16 /* result */)
- IPC_SYNC_MESSAGE_CONTROL0_1(ViewHostMsg_ClipboardReadAsciiText,
+ IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_ClipboardReadAsciiText,
+ Clipboard::Buffer /* buffer */,
std::string /* result */)
- IPC_SYNC_MESSAGE_CONTROL0_2(ViewHostMsg_ClipboardReadHTML,
+ IPC_SYNC_MESSAGE_CONTROL1_2(ViewHostMsg_ClipboardReadHTML,
+ Clipboard::Buffer /* buffer */,
string16 /* markup */,
GURL /* url */)
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index cd422f2..e91936e 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -354,7 +354,6 @@ void RenderView::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(ViewMsg_Find, OnFind)
IPC_MESSAGE_HANDLER(ViewMsg_DeterminePageText, OnDeterminePageText)
IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom)
- IPC_MESSAGE_HANDLER(ViewMsg_InsertText, OnInsertText)
IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding)
IPC_MESSAGE_HANDLER(ViewMsg_SetupDevToolsClient, OnSetupDevToolsClient)
IPC_MESSAGE_HANDLER(ViewMsg_DownloadFavIcon, OnDownloadFavIcon)
@@ -2572,13 +2571,6 @@ void RenderView::OnZoom(int function) {
}
}
-void RenderView::OnInsertText(const string16& text) {
- WebFrame* frame = webview()->GetFocusedFrame();
- if (!frame)
- return;
- frame->insertText(text);
-}
-
void RenderView::OnSetPageEncoding(const std::string& encoding_name) {
webview()->SetPageEncoding(encoding_name);
}
@@ -2625,10 +2617,6 @@ WebDevToolsAgentDelegate* RenderView::GetWebDevToolsAgentDelegate() {
return devtools_agent_.get();
}
-void RenderView::PasteFromSelectionClipboard() {
- Send(new ViewHostMsg_PasteFromSelectionClipboard(routing_id_));
-}
-
WebFrame* RenderView::GetChildFrame(const std::wstring& xpath) const {
if (xpath.empty())
return webview()->GetMainFrame();
diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h
index 34d48a9..3274d44 100644
--- a/chrome/renderer/render_view.h
+++ b/chrome/renderer/render_view.h
@@ -314,7 +314,6 @@ class RenderView : public RenderWidget,
virtual void DownloadUrl(const GURL& url, const GURL& referrer);
virtual void UpdateInspectorSettings(const std::wstring& raw_settings);
virtual WebDevToolsAgentDelegate* GetWebDevToolsAgentDelegate();
- virtual void PasteFromSelectionClipboard();
virtual void ReportFindInPageMatchCount(int count, int request_id,
bool final_update);
virtual void ReportFindInPageSelection(int request_id,
@@ -540,7 +539,6 @@ class RenderView : public RenderWidget,
void OnFind(int request_id, const string16&, const WebKit::WebFindOptions&);
void OnDeterminePageText();
void OnZoom(int function);
- void OnInsertText(const string16& text);
void OnSetPageEncoding(const std::string& encoding_name);
void OnGetAllSavableResourceLinksForCurrentPage(const GURL& page_url);
void OnGetSerializedHtmlDataForCurrentPageWithLocalLinks(
diff --git a/chrome/renderer/renderer_glue.cc b/chrome/renderer/renderer_glue.cc
index c42e8a6..2597264 100644
--- a/chrome/renderer/renderer_glue.cc
+++ b/chrome/renderer/renderer_glue.cc
@@ -174,23 +174,27 @@ Clipboard* ClipboardGetClipboard(){
return NULL;
}
-bool ClipboardIsFormatAvailable(const Clipboard::FormatType& format) {
+bool ClipboardIsFormatAvailable(const Clipboard::FormatType& format,
+ Clipboard::Buffer buffer) {
bool result;
RenderThread::current()->Send(
- new ViewHostMsg_ClipboardIsFormatAvailable(format, &result));
+ new ViewHostMsg_ClipboardIsFormatAvailable(format, buffer, &result));
return result;
}
-void ClipboardReadText(string16* result) {
- RenderThread::current()->Send(new ViewHostMsg_ClipboardReadText(result));
+void ClipboardReadText(Clipboard::Buffer buffer, string16* result) {
+ RenderThread::current()->Send(new ViewHostMsg_ClipboardReadText(buffer,
+ result));
}
-void ClipboardReadAsciiText(std::string* result) {
- RenderThread::current()->Send(new ViewHostMsg_ClipboardReadAsciiText(result));
+void ClipboardReadAsciiText(Clipboard::Buffer buffer, std::string* result) {
+ RenderThread::current()->Send(new ViewHostMsg_ClipboardReadAsciiText(buffer,
+ result));
}
-void ClipboardReadHTML(string16* markup, GURL* url) {
- RenderThread::current()->Send(new ViewHostMsg_ClipboardReadHTML(markup, url));
+void ClipboardReadHTML(Clipboard::Buffer buffer, string16* markup, GURL* url) {
+ RenderThread::current()->Send(new ViewHostMsg_ClipboardReadHTML(buffer,
+ markup, url));
}
GURL GetInspectorURL() {
diff --git a/views/controls/textfield/native_textfield_win.cc b/views/controls/textfield/native_textfield_win.cc
index 6bae442..e152dbe 100644
--- a/views/controls/textfield/native_textfield_win.cc
+++ b/views/controls/textfield/native_textfield_win.cc
@@ -664,11 +664,12 @@ void NativeTextfieldWin::OnPaste() {
return;
Clipboard* clipboard = ViewsDelegate::views_delegate->GetClipboard();
- if (!clipboard->IsFormatAvailable(Clipboard::GetPlainTextWFormatType()))
+ if (!clipboard->IsFormatAvailable(Clipboard::GetPlainTextWFormatType(),
+ Clipboard::BUFFER_STANDARD))
return;
std::wstring clipboard_str;
- clipboard->ReadText(&clipboard_str);
+ clipboard->ReadText(Clipboard::BUFFER_STANDARD, &clipboard_str);
if (!clipboard_str.empty()) {
std::wstring collapsed(CollapseWhitespace(clipboard_str, false));
if (textfield_->style() & Textfield::STYLE_LOWERCASE)
diff --git a/views/view_unittest.cc b/views/view_unittest.cc
index e02afd73a..613c522 100644
--- a/views/view_unittest.cc
+++ b/views/view_unittest.cc
@@ -727,7 +727,7 @@ TEST_F(ViewTest, TextfieldCutCopyPaste) {
::SendMessage(normal->GetTestingHandle(), WM_CUT, 0, 0);
string16 result;
- clipboard.ReadText(&result);
+ clipboard.ReadText(Clipboard::BUFFER_STANDARD, &result);
EXPECT_EQ(kNormalText, result);
normal->SetText(kNormalText); // Let's revert to the original content.
@@ -735,7 +735,7 @@ TEST_F(ViewTest, TextfieldCutCopyPaste) {
read_only->SelectAll();
::SendMessage(read_only->GetTestingHandle(), WM_CUT, 0, 0);
result.clear();
- clipboard.ReadText(&result);
+ clipboard.ReadText(Clipboard::BUFFER_STANDARD, &result);
// Cut should have failed, so the clipboard content should not have changed.
EXPECT_EQ(kNormalText, result);
@@ -743,7 +743,7 @@ TEST_F(ViewTest, TextfieldCutCopyPaste) {
password->SelectAll();
::SendMessage(password->GetTestingHandle(), WM_CUT, 0, 0);
result.clear();
- clipboard.ReadText(&result);
+ clipboard.ReadText(Clipboard::BUFFER_STANDARD, &result);
// Cut should have failed, so the clipboard content should not have changed.
EXPECT_EQ(kNormalText, result);
@@ -756,19 +756,19 @@ TEST_F(ViewTest, TextfieldCutCopyPaste) {
read_only->SelectAll();
::SendMessage(read_only->GetTestingHandle(), WM_COPY, 0, 0);
result.clear();
- clipboard.ReadText(&result);
+ clipboard.ReadText(Clipboard::BUFFER_STANDARD, &result);
EXPECT_EQ(kReadOnlyText, result);
normal->SelectAll();
::SendMessage(normal->GetTestingHandle(), WM_COPY, 0, 0);
result.clear();
- clipboard.ReadText(&result);
+ clipboard.ReadText(Clipboard::BUFFER_STANDARD, &result);
EXPECT_EQ(kNormalText, result);
password->SelectAll();
::SendMessage(password->GetTestingHandle(), WM_COPY, 0, 0);
result.clear();
- clipboard.ReadText(&result);
+ clipboard.ReadText(Clipboard::BUFFER_STANDARD, &result);
// We don't let you copy from a password field, clipboard should not have
// changed.
EXPECT_EQ(kNormalText, result);
diff --git a/webkit/api/public/WebClipboard.h b/webkit/api/public/WebClipboard.h
index 311800b..d995680 100644
--- a/webkit/api/public/WebClipboard.h
+++ b/webkit/api/public/WebClipboard.h
@@ -46,10 +46,17 @@ namespace WebKit {
FormatSmartPaste
};
- virtual bool isFormatAvailable(Format) = 0;
+ enum Buffer {
+ BufferStandard,
+ // Used on platforms like the X Window System that treat selection
+ // as a type of clipboard.
+ BufferSelection
+ };
+
+ virtual bool isFormatAvailable(Format, Buffer) = 0;
- virtual WebString readPlainText() = 0;
- virtual WebString readHTML(WebURL*) = 0;
+ virtual WebString readPlainText(Buffer) = 0;
+ virtual WebString readHTML(Buffer, WebURL*) = 0;
virtual void writeHTML(
const WebString& htmlText, const WebURL&,
diff --git a/webkit/api/public/WebViewClient.h b/webkit/api/public/WebViewClient.h
index fbb56d0..54dae44 100644
--- a/webkit/api/public/WebViewClient.h
+++ b/webkit/api/public/WebViewClient.h
@@ -1,10 +1,10 @@
/*
* Copyright (C) 2009 Google Inc. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
@@ -14,7 +14,7 @@
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -97,12 +97,6 @@ namespace WebKit {
virtual void spellCheck(
const WebString& word, int& misspelledOffset, int& misspelledLength) = 0;
- // Request the text on the selection clipboard be sent back to the
- // WebView so it can be inserted into the current focus area. This is
- // only meaningful on platforms that have a selection clipboard (e.g.,
- // X-Windows).
- virtual void pasteFromSelectionClipboard() = 0;
-
// Dialogs -------------------------------------------------------------
diff --git a/webkit/api/src/AssertMatchingEnums.cpp b/webkit/api/src/AssertMatchingEnums.cpp
index c40d708..32a79c0 100644
--- a/webkit/api/src/AssertMatchingEnums.cpp
+++ b/webkit/api/src/AssertMatchingEnums.cpp
@@ -73,6 +73,9 @@ COMPILE_ASSERT_MATCHING_ENUM(WebClipboard::FormatHTML, PasteboardPrivate::HTMLFo
COMPILE_ASSERT_MATCHING_ENUM(WebClipboard::FormatBookmark, PasteboardPrivate::BookmarkFormat);
COMPILE_ASSERT_MATCHING_ENUM(WebClipboard::FormatSmartPaste, PasteboardPrivate::WebSmartPasteFormat);
+COMPILE_ASSERT_MATCHING_ENUM(WebClipboard::BufferStandard, PasteboardPrivate::StandardBuffer);
+COMPILE_ASSERT_MATCHING_ENUM(WebClipboard::BufferSelection, PasteboardPrivate::SelectionBuffer);
+
COMPILE_ASSERT_MATCHING_ENUM(WebCursorInfo::TypePointer, PlatformCursor::TypePointer);
COMPILE_ASSERT_MATCHING_ENUM(WebCursorInfo::TypeCross, PlatformCursor::TypeCross);
COMPILE_ASSERT_MATCHING_ENUM(WebCursorInfo::TypeHand, PlatformCursor::TypeHand);
diff --git a/webkit/api/src/ChromiumBridge.cpp b/webkit/api/src/ChromiumBridge.cpp
index 8d6dc25..9b07db3 100644
--- a/webkit/api/src/ChromiumBridge.cpp
+++ b/webkit/api/src/ChromiumBridge.cpp
@@ -72,21 +72,28 @@ namespace WebCore {
// Clipboard ------------------------------------------------------------------
bool ChromiumBridge::clipboardIsFormatAvailable(
- PasteboardPrivate::ClipboardFormat format)
+ PasteboardPrivate::ClipboardFormat format,
+ PasteboardPrivate::ClipboardBuffer buffer)
{
return webKitClient()->clipboard()->isFormatAvailable(
- static_cast<WebClipboard::Format>(format));
+ static_cast<WebClipboard::Format>(format),
+ static_cast<WebClipboard::Buffer>(buffer));
}
-String ChromiumBridge::clipboardReadPlainText()
+String ChromiumBridge::clipboardReadPlainText(
+ PasteboardPrivate::ClipboardBuffer buffer)
{
- return webKitClient()->clipboard()->readPlainText();
+ return webKitClient()->clipboard()->readPlainText(
+ static_cast<WebClipboard::Buffer>(buffer));
}
-void ChromiumBridge::clipboardReadHTML(String* htmlText, KURL* sourceURL)
+void ChromiumBridge::clipboardReadHTML(
+ PasteboardPrivate::ClipboardBuffer buffer,
+ String* htmlText, KURL* sourceURL)
{
WebURL url;
- *htmlText = webKitClient()->clipboard()->readHTML(&url);
+ *htmlText = webKitClient()->clipboard()->readHTML(
+ static_cast<WebClipboard::Buffer>(buffer), &url);
*sourceURL = url;
}
diff --git a/webkit/glue/webclipboard_impl.cc b/webkit/glue/webclipboard_impl.cc
index e2be557..4798eff 100644
--- a/webkit/glue/webclipboard_impl.cc
+++ b/webkit/glue/webclipboard_impl.cc
@@ -55,8 +55,9 @@ std::string WebClipboardImpl::URLToImageMarkup(const WebURL& url,
return markup;
}
-bool WebClipboardImpl::isFormatAvailable(Format format) {
+bool WebClipboardImpl::isFormatAvailable(Format format, Buffer buffer) {
Clipboard::FormatType format_type;
+ Clipboard::Buffer buffer_type;
switch (format) {
case FormatHTML:
@@ -75,20 +76,29 @@ bool WebClipboardImpl::isFormatAvailable(Format format) {
return false;
}
- return ClipboardIsFormatAvailable(format_type);
+ if (!ConvertBufferType(buffer, &buffer_type))
+ return false;
+
+ return ClipboardIsFormatAvailable(format_type, buffer_type);
}
-WebString WebClipboardImpl::readPlainText() {
- if (ClipboardIsFormatAvailable(Clipboard::GetPlainTextWFormatType())) {
+WebString WebClipboardImpl::readPlainText(Buffer buffer) {
+ Clipboard::Buffer buffer_type;
+ if (!ConvertBufferType(buffer, &buffer_type))
+ return WebString();
+
+ if (ClipboardIsFormatAvailable(Clipboard::GetPlainTextWFormatType(),
+ buffer_type)) {
string16 text;
- ClipboardReadText(&text);
+ ClipboardReadText(buffer_type, &text);
if (!text.empty())
return text;
}
- if (ClipboardIsFormatAvailable(Clipboard::GetPlainTextFormatType())) {
+ if (ClipboardIsFormatAvailable(Clipboard::GetPlainTextFormatType(),
+ buffer_type)) {
std::string text;
- ClipboardReadAsciiText(&text);
+ ClipboardReadAsciiText(buffer_type, &text);
if (!text.empty())
return ASCIIToUTF16(text);
}
@@ -96,10 +106,14 @@ WebString WebClipboardImpl::readPlainText() {
return WebString();
}
-WebString WebClipboardImpl::readHTML(WebURL* source_url) {
+WebString WebClipboardImpl::readHTML(Buffer buffer, WebURL* source_url) {
+ Clipboard::Buffer buffer_type;
+ if (!ConvertBufferType(buffer, &buffer_type))
+ return WebString();
+
string16 html_stdstr;
GURL gurl;
- ClipboardReadHTML(&html_stdstr, &gurl);
+ ClipboardReadHTML(buffer_type, &html_stdstr, &gurl);
*source_url = gurl;
return html_stdstr;
}
@@ -144,4 +158,22 @@ void WebClipboardImpl::writeImage(
}
}
+bool WebClipboardImpl::ConvertBufferType(Buffer buffer,
+ Clipboard::Buffer* result) {
+ switch (buffer) {
+ case BufferStandard:
+ *result = Clipboard::BUFFER_STANDARD;
+ break;
+ case BufferSelection:
+#if defined(OS_LINUX)
+ *result = Clipboard::BUFFER_SELECTION;
+ break;
+#endif
+ default:
+ NOTREACHED();
+ return false;
+ }
+ return true;
+}
+
} // namespace webkit_glue
diff --git a/webkit/glue/webclipboard_impl.h b/webkit/glue/webclipboard_impl.h
index 52762da..cc86505 100644
--- a/webkit/glue/webclipboard_impl.h
+++ b/webkit/glue/webclipboard_impl.h
@@ -5,6 +5,7 @@
#ifndef WEBCLIPBOARD_IMPL_H_
#define WEBCLIPBOARD_IMPL_H_
+#include "base/clipboard.h"
#include "webkit/api/public/WebClipboard.h"
#include <string>
@@ -21,9 +22,9 @@ class WebClipboardImpl : public WebKit::WebClipboard {
virtual ~WebClipboardImpl() {}
// WebClipboard methods:
- virtual bool isFormatAvailable(WebKit::WebClipboard::Format);
- virtual WebKit::WebString readPlainText();
- virtual WebKit::WebString readHTML(WebKit::WebURL* source_url);
+ virtual bool isFormatAvailable(Format, Buffer);
+ virtual WebKit::WebString readPlainText(Buffer);
+ virtual WebKit::WebString readHTML(Buffer, WebKit::WebURL* source_url);
virtual void writeHTML(
const WebKit::WebString& html_text,
const WebKit::WebURL& source_url,
@@ -36,6 +37,9 @@ class WebClipboardImpl : public WebKit::WebClipboard {
const WebKit::WebImage&,
const WebKit::WebURL& source_url,
const WebKit::WebString& title);
+
+ private:
+ bool ConvertBufferType(Buffer, Clipboard::Buffer*);
};
} // namespace webkit_glue
diff --git a/webkit/glue/webkit_glue.h b/webkit/glue/webkit_glue.h
index 24e3f46..302f047 100644
--- a/webkit/glue/webkit_glue.h
+++ b/webkit/glue/webkit_glue.h
@@ -152,16 +152,17 @@ HCURSOR LoadCursor(int cursor_id);
Clipboard* ClipboardGetClipboard();
// Tests whether the clipboard contains a certain format
-bool ClipboardIsFormatAvailable(const Clipboard::FormatType& format);
+bool ClipboardIsFormatAvailable(const Clipboard::FormatType& format,
+ Clipboard::Buffer buffer);
// Reads UNICODE text from the clipboard, if available.
-void ClipboardReadText(string16* result);
+void ClipboardReadText(Clipboard::Buffer buffer, string16* result);
// Reads ASCII text from the clipboard, if available.
-void ClipboardReadAsciiText(std::string* result);
+void ClipboardReadAsciiText(Clipboard::Buffer buffer, std::string* result);
// Reads HTML from the clipboard, if available.
-void ClipboardReadHTML(string16* markup, GURL* url);
+void ClipboardReadHTML(Clipboard::Buffer buffer, string16* markup, GURL* url);
// Gets the directory where the application data and libraries exist. This
// may be a versioned subdirectory, or it may be the same directory as the
diff --git a/webkit/glue/webview_delegate.h b/webkit/glue/webview_delegate.h
index 7a8e313..99d9be36 100644
--- a/webkit/glue/webview_delegate.h
+++ b/webkit/glue/webview_delegate.h
@@ -719,14 +719,6 @@ class WebViewDelegate : virtual public WebKit::WebWidgetClient {
return NULL;
}
- // Selection clipboard -----------------------------------------------------
-
- // Request the text on the selection clipboard be sent back to the webview
- // so it can be inserted into the current focus area. In response to this call
- // the delegate should get the text and send it to the WebView via
- // InsertText().
- virtual void PasteFromSelectionClipboard() { }
-
// Editor Client -----------------------------------------------------------
// Returns true if the word is spelled correctly. The word may begin or end
diff --git a/webkit/glue/webview_impl.cc b/webkit/glue/webview_impl.cc
index cc9ebbd..f3cf268 100644
--- a/webkit/glue/webview_impl.cc
+++ b/webkit/glue/webview_impl.cc
@@ -35,6 +35,7 @@ MSVC_PUSH_WARNING_LEVEL(0);
#include "NodeRenderStyle.h"
#include "Page.h"
#include "PageGroup.h"
+#include "Pasteboard.h"
#include "PlatformContextSkia.h"
#include "PlatformKeyboardEvent.h"
#include "PlatformMouseEvent.h"
@@ -564,8 +565,11 @@ void WebViewImpl::MouseUp(const WebMouseEvent& event) {
ShouldHitTestScrollbars);
if (!hit_test_result.scrollbar() && focused) {
Editor* editor = focused->editor();
- if (editor && editor->canEdit())
- delegate_->PasteFromSelectionClipboard();
+ Pasteboard* pasteboard = Pasteboard::generalPasteboard();
+ bool oldSelectionMode = pasteboard->isSelectionMode();
+ pasteboard->setSelectionMode(true);
+ editor->command(AtomicString("Paste")).execute();
+ pasteboard->setSelectionMode(oldSelectionMode);
}
}
#endif
diff --git a/webkit/tools/layout_tests/test_expectations.txt b/webkit/tools/layout_tests/test_expectations.txt
index 6aa8922..54aeab7 100644
--- a/webkit/tools/layout_tests/test_expectations.txt
+++ b/webkit/tools/layout_tests/test_expectations.txt
@@ -586,9 +586,6 @@ WONTFIX : LayoutTests/storage/domstorage/sessionstorage/private-browsing-affects
// Depends on SessionStorage. I'm not sure if this is working yet, but I don't think we need to SKIP it.
BUG4360 : LayoutTests/http/tests/loading/deleted-host-in-resource-load-delegate-callback.html = TIMEOUT
-// WebKit and us disagree how this is best done. Disable for now.
-BUG4360 : LayoutTests/storage/domstorage/localstorage/complex-keys.html = FAIL
-
// Database
BUG4359 SKIP : LayoutTests/storage/close-during-stress-test.html = PASS
BUG4359 SKIP : LayoutTests/storage/database-lock-after-reload.html = PASS
@@ -1993,9 +1990,6 @@ BUG11123 LINUX : LayoutTests/fast/css/nested-layers-with-hover.html = FAIL
BUG11123 LINUX : LayoutTests/fast/forms/textarea-scrollbar.html = FAIL
BUG11123 LINUX : LayoutTests/fast/forms/textarea-scrolled-type.html = FAIL
-// New tests from WebKit Merge 42932:42994
-BUG21128 : LayoutTests/http/tests/xmlhttprequest/detaching-frame-2.html = FAIL
-
// Chrome does not support WebArchives (just like Safari for Windows),
// although we might eventually want to on Mac.
WONTFIX SKIP : LayoutTests/webarchive/adopt-attribute-styled-body-webarchive.html = FAIL
@@ -2433,9 +2427,8 @@ BUG_VICTORW : LayoutTests/http/tests/security/javascriptURL/xss-ALLOWED-from-jav
// Webkit 48061:48071
BUG_VICTORW WIN DEBUG : LayoutTests/fast/regex/cross-frame-callable.html = TIMEOUT
-// Webkit 48071:48078
-BUG_VICTORW MAC : LayoutTests/fast/forms/enter-clicks-buttons.html = CRASH
-
// WebKit 48098:48155
BUG21267 : LayoutTests/fast/events/click-focus-anchor.html = FAIL
BUG21267 : LayoutTests/fast/events/tab-focus-anchor.html = FAIL
+
+BUG_JAPHET MAC : LayoutTests/animations/change-keyframes-name.html = FAIL PASS
diff --git a/webkit/tools/test_shell/mock_webclipboard_impl.cc b/webkit/tools/test_shell/mock_webclipboard_impl.cc
index 32f3f01..7a428be 100644
--- a/webkit/tools/test_shell/mock_webclipboard_impl.cc
+++ b/webkit/tools/test_shell/mock_webclipboard_impl.cc
@@ -16,7 +16,7 @@
using WebKit::WebString;
using WebKit::WebURL;
-bool MockWebClipboardImpl::isFormatAvailable(Format format) {
+bool MockWebClipboardImpl::isFormatAvailable(Format format, Buffer buffer) {
switch (format) {
case FormatHTML:
return !m_htmlText.isEmpty();
@@ -28,15 +28,30 @@ bool MockWebClipboardImpl::isFormatAvailable(Format format) {
NOTREACHED();
return false;
}
+
+ switch (buffer) {
+ case BufferStandard:
+ break;
+ case BufferSelection:
+#if defined(OS_LINUX)
+ break;
+#endif
+ default:
+ NOTREACHED();
+ return false;
+ }
+
return true;
}
-WebKit::WebString MockWebClipboardImpl::readPlainText() {
+WebKit::WebString MockWebClipboardImpl::readPlainText(
+ WebKit::WebClipboard::Buffer buffer) {
return m_plainText;
}
// TODO(wtc): set output argument *url.
-WebKit::WebString MockWebClipboardImpl::readHTML(WebKit::WebURL* url) {
+WebKit::WebString MockWebClipboardImpl::readHTML(
+ WebKit::WebClipboard::Buffer buffer, WebKit::WebURL* url) {
return m_htmlText;
}
diff --git a/webkit/tools/test_shell/mock_webclipboard_impl.h b/webkit/tools/test_shell/mock_webclipboard_impl.h
index dd47835..4aa616f 100644
--- a/webkit/tools/test_shell/mock_webclipboard_impl.h
+++ b/webkit/tools/test_shell/mock_webclipboard_impl.h
@@ -15,10 +15,12 @@
class MockWebClipboardImpl : public WebKit::WebClipboard {
public:
- virtual bool isFormatAvailable(WebKit::WebClipboard::Format);
+ virtual bool isFormatAvailable(WebKit::WebClipboard::Format,
+ WebKit::WebClipboard::Buffer);
- virtual WebKit::WebString readPlainText();
- virtual WebKit::WebString readHTML(WebKit::WebURL*);
+ virtual WebKit::WebString readPlainText(WebKit::WebClipboard::Buffer);
+ virtual WebKit::WebString readHTML(WebKit::WebClipboard::Buffer,
+ WebKit::WebURL*);
virtual void writeHTML(
const WebKit::WebString& htmlText, const WebKit::WebURL&,
diff --git a/webkit/tools/test_shell/simple_clipboard_impl.cc b/webkit/tools/test_shell/simple_clipboard_impl.cc
index 323c04c..fc67ece 100644
--- a/webkit/tools/test_shell/simple_clipboard_impl.cc
+++ b/webkit/tools/test_shell/simple_clipboard_impl.cc
@@ -33,21 +33,22 @@ Clipboard* ClipboardGetClipboard() {
return clipboard.Pointer();
}
-bool ClipboardIsFormatAvailable(const Clipboard::FormatType& format) {
- return ClipboardGetClipboard()->IsFormatAvailable(format);
+bool ClipboardIsFormatAvailable(const Clipboard::FormatType& format,
+ Clipboard::Buffer buffer) {
+ return ClipboardGetClipboard()->IsFormatAvailable(format, buffer);
}
-void ClipboardReadText(string16* result) {
- ClipboardGetClipboard()->ReadText(result);
+void ClipboardReadText(Clipboard::Buffer buffer, string16* result) {
+ ClipboardGetClipboard()->ReadText(buffer, result);
}
-void ClipboardReadAsciiText(std::string* result) {
- ClipboardGetClipboard()->ReadAsciiText(result);
+void ClipboardReadAsciiText(Clipboard::Buffer buffer, std::string* result) {
+ ClipboardGetClipboard()->ReadAsciiText(buffer, result);
}
-void ClipboardReadHTML(string16* markup, GURL* url) {
+void ClipboardReadHTML(Clipboard::Buffer buffer, string16* markup, GURL* url) {
std::string url_str;
- ClipboardGetClipboard()->ReadHTML(markup, url ? &url_str : NULL);
+ ClipboardGetClipboard()->ReadHTML(buffer, markup, url ? &url_str : NULL);
if (url)
*url = GURL(url_str);
}