summaryrefslogtreecommitdiffstats
path: root/base/scoped_clipboard_writer.cc
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-04 21:52:29 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-04 21:52:29 +0000
commitb08cadb9ab90b41af81b9fd8da65fb52433c8004 (patch)
tree55738edf0c98b596cd6f9a89533e92f5a82c6fff /base/scoped_clipboard_writer.cc
parent021d688a1e02ae7bd88e54162d5d25e1dae52e7c (diff)
downloadchromium_src-b08cadb9ab90b41af81b9fd8da65fb52433c8004.zip
chromium_src-b08cadb9ab90b41af81b9fd8da65fb52433c8004.tar.gz
chromium_src-b08cadb9ab90b41af81b9fd8da65fb52433c8004.tar.bz2
GTK: implement bookmark manager copy/paste.
- Refactor bookmark util clipboard code to be cross platform. - Add a CBF_DATA format for writing arbitrary data to the clipboard. - Change MenuGtk so that showing a menu only makes the menu items update asynchronously. This way we can show the menu immediately and we won't get in trouble if the delegate's IsCommandEnabled() runs a nested message loop. I did not do any mac-side implementation of the new clipboard stuff. The implementation should be easy when they get around to writing the bookmark manager. Review URL: http://codereview.chromium.org/159815 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22419 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/scoped_clipboard_writer.cc')
-rw-r--r--base/scoped_clipboard_writer.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/base/scoped_clipboard_writer.cc b/base/scoped_clipboard_writer.cc
index f413061..1e9e846 100644
--- a/base/scoped_clipboard_writer.cc
+++ b/base/scoped_clipboard_writer.cc
@@ -6,9 +6,11 @@
// purpose can be found in base/scoped_clipboard_writer.h. Documentation on the
// format of the parameters for each clipboard target can be found in
// base/clipboard.h.
+
#include "base/scoped_clipboard_writer.h"
#include "base/gfx/size.h"
+#include "base/pickle.h"
#include "base/string_util.h"
ScopedClipboardWriter::ScopedClipboardWriter(Clipboard* clipboard)
@@ -139,3 +141,18 @@ void ScopedClipboardWriter::WriteBitmapFromPixels(const void* pixels,
parameters.push_back(size_parameter);
objects_[Clipboard::CBF_BITMAP] = parameters;
}
+
+void ScopedClipboardWriter::WritePickledData(const Pickle& pickle,
+ Clipboard::FormatType format) {
+ Clipboard::ObjectMapParam format_parameter(format.begin(), format.end());
+ Clipboard::ObjectMapParam data_parameter;
+
+ data_parameter.resize(pickle.size());
+ memcpy(const_cast<char*>(&data_parameter.front()),
+ pickle.data(), pickle.size());
+
+ Clipboard::ObjectMapParams parameters;
+ parameters.push_back(format_parameter);
+ parameters.push_back(data_parameter);
+ objects_[Clipboard::CBF_DATA] = parameters;
+}