| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // This file provides the embedder's side of the Clipboard interface. | 5 // This file provides the embedder's side of the Clipboard interface. |
| 6 | 6 |
| 7 #include "content/renderer/renderer_clipboard_client.h" | 7 #include "content/renderer/renderer_clipboard_client.h" |
| 8 | 8 |
| 9 #include "base/memory/shared_memory.h" | 9 #include "base/memory/shared_memory.h" |
| 10 #include "base/numerics/safe_math.h" | 10 #include "base/numerics/safe_math.h" |
| 11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
| 12 #include "content/common/clipboard_messages.h" | 12 #include "content/common/clipboard_messages.h" |
| 13 #include "content/public/renderer/content_renderer_client.h" | 13 #include "content/public/renderer/content_renderer_client.h" |
| 14 #include "content/renderer/render_thread_impl.h" | 14 #include "content/renderer/render_thread_impl.h" |
| 15 #include "content/renderer/scoped_clipboard_writer_glue.h" | 15 #include "content/renderer/scoped_clipboard_writer_glue.h" |
| 16 #include "ui/base/clipboard/clipboard.h" | 16 #include "ui/base/clipboard/clipboard.h" |
| 17 #include "ui/gfx/size.h" | 17 #include "ui/gfx/size.h" |
| 18 | 18 |
| 19 namespace content { | 19 namespace content { |
| 20 | 20 |
| 21 namespace { | 21 namespace { |
| 22 | 22 |
| 23 class RendererClipboardWriteContext : public ClipboardClient::WriteContext { | 23 class RendererClipboardWriteContext : public ClipboardClient::WriteContext { |
| 24 public: | 24 public: |
| 25 RendererClipboardWriteContext(); | 25 RendererClipboardWriteContext(); |
| 26 virtual ~RendererClipboardWriteContext(); | 26 ~RendererClipboardWriteContext() override; |
| 27 virtual void WriteBitmapFromPixels(ui::Clipboard::ObjectMap* objects, | 27 void WriteBitmapFromPixels(ui::Clipboard::ObjectMap* objects, |
| 28 const void* pixels, | 28 const void* pixels, |
| 29 const gfx::Size& size) override; | 29 const gfx::Size& size) override; |
| 30 virtual void Flush(const ui::Clipboard::ObjectMap& objects) override; | 30 void Flush(const ui::Clipboard::ObjectMap& objects) override; |
| 31 | 31 |
| 32 private: | 32 private: |
| 33 scoped_ptr<base::SharedMemory> shared_buf_; | 33 scoped_ptr<base::SharedMemory> shared_buf_; |
| 34 DISALLOW_COPY_AND_ASSIGN(RendererClipboardWriteContext); | 34 DISALLOW_COPY_AND_ASSIGN(RendererClipboardWriteContext); |
| 35 }; | 35 }; |
| 36 | 36 |
| 37 RendererClipboardWriteContext::RendererClipboardWriteContext() { | 37 RendererClipboardWriteContext::RendererClipboardWriteContext() { |
| 38 } | 38 } |
| 39 | 39 |
| 40 RendererClipboardWriteContext::~RendererClipboardWriteContext() { | 40 RendererClipboardWriteContext::~RendererClipboardWriteContext() { |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 base::string16* data) { | 171 base::string16* data) { |
| 172 RenderThreadImpl::current()->Send( | 172 RenderThreadImpl::current()->Send( |
| 173 new ClipboardHostMsg_ReadCustomData(clipboard_type, type, data)); | 173 new ClipboardHostMsg_ReadCustomData(clipboard_type, type, data)); |
| 174 } | 174 } |
| 175 | 175 |
| 176 ClipboardClient::WriteContext* RendererClipboardClient::CreateWriteContext() { | 176 ClipboardClient::WriteContext* RendererClipboardClient::CreateWriteContext() { |
| 177 return new RendererClipboardWriteContext; | 177 return new RendererClipboardWriteContext; |
| 178 } | 178 } |
| 179 | 179 |
| 180 } // namespace content | 180 } // namespace content |
| OLD | NEW |