diff options
author | dcheng@chromium.org <dcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-07 01:26:52 +0000 |
---|---|---|
committer | dcheng@chromium.org <dcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-07 01:26:52 +0000 |
commit | fbf75410448e70098395663fc6274d2b400cd45c (patch) | |
tree | 806dd6b308cd5a6deec73f42b929fc695d4dc6c4 /webkit/glue | |
parent | 672704ff9b8498f28467cb1965407b98e79c71f2 (diff) | |
download | chromium_src-fbf75410448e70098395663fc6274d2b400cd45c.zip chromium_src-fbf75410448e70098395663fc6274d2b400cd45c.tar.gz chromium_src-fbf75410448e70098395663fc6274d2b400cd45c.tar.bz2 |
Fix ^C/^X in Bookmark Manager.
This fixes WebClipboardImpl so that writing an empty DataTransfer object is a
no-op again. This is required because calling the bookmark manager extension
functions to copy/cut a bookmark cause ScopedClipboardWriters to be nested.
BUG=108293
TEST=manual
Review URL: http://codereview.chromium.org/9122016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@116794 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue')
-rw-r--r-- | webkit/glue/webclipboard_impl.cc | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/webkit/glue/webclipboard_impl.cc b/webkit/glue/webclipboard_impl.cc index a6a6402..2396294 100644 --- a/webkit/glue/webclipboard_impl.cc +++ b/webkit/glue/webclipboard_impl.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -239,18 +239,22 @@ void WebClipboardImpl::writeImage( } void WebClipboardImpl::writeDataObject(const WebDragData& data) { - // TODO(dcheng): This actually results in a double clear of the clipboard. - // Once in WebKit, and once here when the clipboard writer goes out of scope. - // The same is true of the other WebClipboard::write* methods. ScopedClipboardWriterGlue scw(client_); WebDropData data_object(data); // TODO(dcheng): Properly support text/uri-list here. scw.WriteText(data_object.plain_text); scw.WriteHTML(data_object.text_html, ""); - Pickle pickle; - ui::WriteCustomDataToPickle(data_object.custom_data, &pickle); - scw.WritePickledData(pickle, ui::Clipboard::GetWebCustomDataFormatType()); + // If there is no custom data, avoid calling WritePickledData. This ensures + // that ScopedClipboardWriterGlue's dtor remains a no-op if the page didn't + // modify the DataTransfer object, which is important to avoid stomping on + // any clipboard contents written by extension functions such as + // chrome.experimental.bookmarkManager.copy. + if (!data_object.custom_data.empty()) { + Pickle pickle; + ui::WriteCustomDataToPickle(data_object.custom_data, &pickle); + scw.WritePickledData(pickle, ui::Clipboard::GetWebCustomDataFormatType()); + } } bool WebClipboardImpl::ConvertBufferType(Buffer buffer, |