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

Unified Diff: content/renderer/scoped_clipboard_writer_glue.cc

Issue 740003003: Revert of Rewrite clipboard write IPC handling to be easier to understand. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 | « content/renderer/scoped_clipboard_writer_glue.h ('k') | content/renderer/webclipboard_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/scoped_clipboard_writer_glue.cc
diff --git a/content/renderer/scoped_clipboard_writer_glue.cc b/content/renderer/scoped_clipboard_writer_glue.cc
new file mode 100644
index 0000000000000000000000000000000000000000..71471344fd5be6158acc6e62f16a9db0f1b0b028
--- /dev/null
+++ b/content/renderer/scoped_clipboard_writer_glue.cc
@@ -0,0 +1,36 @@
+// Copyright (c) 2013 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.
+
+#include "content/renderer/scoped_clipboard_writer_glue.h"
+#include "base/logging.h"
+
+namespace content {
+
+ScopedClipboardWriterGlue::ScopedClipboardWriterGlue(ClipboardClient* client)
+ : ui::ScopedClipboardWriter(ui::CLIPBOARD_TYPE_COPY_PASTE),
+ context_(client->CreateWriteContext()) {
+ DCHECK(context_);
+}
+
+ScopedClipboardWriterGlue::~ScopedClipboardWriterGlue() {
+ if (!objects_.empty() && context_) {
+ context_->Flush(objects_);
+ // TODO(dcheng): Temporary hack while the clipboard IPCs are cleaned up.
+ // This prevents the base class destructor from also trying to (probably
+ // unsuccessfully) flush things to the clipboard.
+ objects_.clear();
+ }
+}
+
+void ScopedClipboardWriterGlue::WriteBitmapFromPixels(const void* pixels,
+ const gfx::Size& size) {
+ if (context_) {
+ context_->WriteBitmapFromPixels(&objects_, pixels, size);
+ } else {
+ NOTREACHED();
+ }
+}
+
+} // namespace content
+
« no previous file with comments | « content/renderer/scoped_clipboard_writer_glue.h ('k') | content/renderer/webclipboard_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698