| 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 #include "webkit/tools/test_shell/simple_clipboard_impl.h" | 5 #include "webkit/tools/test_shell/simple_clipboard_impl.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 string16* markup, | 73 string16* markup, |
| 74 GURL* url, uint32* fragment_start, | 74 GURL* url, uint32* fragment_start, |
| 75 uint32* fragment_end) { | 75 uint32* fragment_end) { |
| 76 std::string url_str; | 76 std::string url_str; |
| 77 GetClipboard()->ReadHTML(buffer, markup, url ? &url_str : NULL, | 77 GetClipboard()->ReadHTML(buffer, markup, url ? &url_str : NULL, |
| 78 fragment_start, fragment_end); | 78 fragment_start, fragment_end); |
| 79 if (url) | 79 if (url) |
| 80 *url = GURL(url_str); | 80 *url = GURL(url_str); |
| 81 } | 81 } |
| 82 | 82 |
| 83 void SimpleClipboardClient::ReadRTF(ui::Clipboard::Buffer buffer, |
| 84 std::string* result) { |
| 85 GetClipboard()->ReadRTF(buffer, result); |
| 86 } |
| 87 |
| 83 void SimpleClipboardClient::ReadImage(ui::Clipboard::Buffer buffer, | 88 void SimpleClipboardClient::ReadImage(ui::Clipboard::Buffer buffer, |
| 84 std::string* data) { | 89 std::string* data) { |
| 85 SkBitmap bitmap = GetClipboard()->ReadImage(buffer); | 90 SkBitmap bitmap = GetClipboard()->ReadImage(buffer); |
| 86 if (bitmap.isNull()) | 91 if (bitmap.isNull()) |
| 87 return; | 92 return; |
| 88 | 93 |
| 89 std::vector<unsigned char> png_data; | 94 std::vector<unsigned char> png_data; |
| 90 SkAutoLockPixels lock(bitmap); | 95 SkAutoLockPixels lock(bitmap); |
| 91 if (gfx::PNGCodec::EncodeWithCompressionLevel( | 96 if (gfx::PNGCodec::EncodeWithCompressionLevel( |
| 92 static_cast<const unsigned char*>(bitmap.getPixels()), | 97 static_cast<const unsigned char*>(bitmap.getPixels()), |
| (...skipping 12 matching lines...) Expand all Loading... |
| 105 void SimpleClipboardClient::ReadCustomData(ui::Clipboard::Buffer buffer, | 110 void SimpleClipboardClient::ReadCustomData(ui::Clipboard::Buffer buffer, |
| 106 const string16& type, | 111 const string16& type, |
| 107 string16* data) { | 112 string16* data) { |
| 108 GetClipboard()->ReadCustomData(buffer, type, data); | 113 GetClipboard()->ReadCustomData(buffer, type, data); |
| 109 } | 114 } |
| 110 | 115 |
| 111 webkit_glue::ClipboardClient::WriteContext* | 116 webkit_glue::ClipboardClient::WriteContext* |
| 112 SimpleClipboardClient::CreateWriteContext() { | 117 SimpleClipboardClient::CreateWriteContext() { |
| 113 return NULL; | 118 return NULL; |
| 114 } | 119 } |
| OLD | NEW |