chrome.bluetoothSocket: clean-up Listen functions
[chromium-blink-merge.git] / content / renderer / scoped_clipboard_writer_glue.cc
blob37790375303820a3454e967d92fc245b018650dd
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "content/renderer/scoped_clipboard_writer_glue.h"
6 #include "base/logging.h"
8 namespace content {
10 ScopedClipboardWriterGlue::ScopedClipboardWriterGlue(ClipboardClient* client)
11 : ui::ScopedClipboardWriter(client->GetClipboard(),
12 ui::CLIPBOARD_TYPE_COPY_PASTE),
13 context_(client->CreateWriteContext()) {
14 // We should never have an instance where both are set.
15 DCHECK((clipboard_ && !context_.get()) ||
16 (!clipboard_ && context_.get()));
19 ScopedClipboardWriterGlue::~ScopedClipboardWriterGlue() {
20 if (!objects_.empty() && context_) {
21 context_->Flush(objects_);
25 void ScopedClipboardWriterGlue::WriteBitmapFromPixels(const void* pixels,
26 const gfx::Size& size) {
27 if (context_) {
28 context_->WriteBitmapFromPixels(&objects_, pixels, size);
29 } else {
30 NOTREACHED();
34 } // namespace content