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 random webkit glue functions. | 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/shared_memory.h" | 9 #include "base/shared_memory.h" |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
11 #include "content/common/clipboard_messages.h" | 11 #include "content/common/clipboard_messages.h" |
12 #include "content/public/renderer/content_renderer_client.h" | 12 #include "content/public/renderer/content_renderer_client.h" |
13 #include "content/renderer/render_thread_impl.h" | 13 #include "content/renderer/render_thread_impl.h" |
| 14 #include "content/renderer/scoped_clipboard_writer_glue.h" |
14 #include "ui/base/clipboard/clipboard.h" | 15 #include "ui/base/clipboard/clipboard.h" |
15 #include "ui/gfx/size.h" | 16 #include "ui/gfx/size.h" |
16 #include "webkit/glue/scoped_clipboard_writer_glue.h" | |
17 | 17 |
18 namespace content { | 18 namespace content { |
19 | 19 |
20 namespace { | 20 namespace { |
21 | 21 |
22 class RendererClipboardWriteContext : | 22 class RendererClipboardWriteContext : public ClipboardClient::WriteContext { |
23 public webkit_glue::ClipboardClient::WriteContext { | |
24 public: | 23 public: |
25 RendererClipboardWriteContext(); | 24 RendererClipboardWriteContext(); |
26 virtual ~RendererClipboardWriteContext(); | 25 virtual ~RendererClipboardWriteContext(); |
27 virtual void WriteBitmapFromPixels(ui::Clipboard::ObjectMap* objects, | 26 virtual void WriteBitmapFromPixels(ui::Clipboard::ObjectMap* objects, |
28 const void* pixels, | 27 const void* pixels, |
29 const gfx::Size& size) OVERRIDE; | 28 const gfx::Size& size) OVERRIDE; |
30 virtual void Flush(const ui::Clipboard::ObjectMap& objects) OVERRIDE; | 29 virtual void Flush(const ui::Clipboard::ObjectMap& objects) OVERRIDE; |
31 | 30 |
32 private: | 31 private: |
33 scoped_ptr<base::SharedMemory> shared_buf_; | 32 scoped_ptr<base::SharedMemory> shared_buf_; |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 RenderThreadImpl::current()->Send( | 176 RenderThreadImpl::current()->Send( |
178 new ClipboardHostMsg_ReadCustomData(buffer, type, data)); | 177 new ClipboardHostMsg_ReadCustomData(buffer, type, data)); |
179 } | 178 } |
180 | 179 |
181 void RendererClipboardClient::ReadData(const ui::Clipboard::FormatType& format, | 180 void RendererClipboardClient::ReadData(const ui::Clipboard::FormatType& format, |
182 std::string* data) { | 181 std::string* data) { |
183 RenderThreadImpl::current()->Send( | 182 RenderThreadImpl::current()->Send( |
184 new ClipboardHostMsg_ReadData(format, data)); | 183 new ClipboardHostMsg_ReadData(format, data)); |
185 } | 184 } |
186 | 185 |
187 webkit_glue::ClipboardClient::WriteContext* | 186 ClipboardClient::WriteContext* RendererClipboardClient::CreateWriteContext() { |
188 RendererClipboardClient::CreateWriteContext() { | |
189 return new RendererClipboardWriteContext; | 187 return new RendererClipboardWriteContext; |
190 } | 188 } |
191 | 189 |
192 } // namespace content | 190 } // namespace content |
OLD | NEW |