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" |
11 #include "base/string16.h" | 11 #include "base/string16.h.h" |
12 #include "googleurl/src/gurl.h" | 12 #include "googleurl/src/gurl.h" |
13 #include "third_party/skia/include/core/SkBitmap.h" | 13 #include "third_party/skia/include/core/SkBitmap.h" |
14 #include "third_party/zlib/zlib.h" | 14 #include "third_party/zlib/zlib.h" |
15 #include "ui/base/clipboard/clipboard.h" | 15 #include "ui/base/clipboard/clipboard.h" |
16 #include "ui/gfx/codec/png_codec.h" | 16 #include "ui/gfx/codec/png_codec.h" |
17 #include "ui/gfx/size.h" | 17 #include "ui/gfx/size.h" |
18 #include "webkit/glue/webkit_glue.h" | 18 #include "webkit/glue/webkit_glue.h" |
19 | 19 |
20 namespace { | 20 namespace { |
21 | 21 |
(...skipping 17 matching lines...) Expand all Loading... |
39 bool SimpleClipboardClient::IsFormatAvailable( | 39 bool SimpleClipboardClient::IsFormatAvailable( |
40 const ui::Clipboard::FormatType& format, | 40 const ui::Clipboard::FormatType& format, |
41 ui::Clipboard::Buffer buffer) { | 41 ui::Clipboard::Buffer buffer) { |
42 return GetClipboard()->IsFormatAvailable(format, buffer); | 42 return GetClipboard()->IsFormatAvailable(format, buffer); |
43 } | 43 } |
44 | 44 |
45 void SimpleClipboardClient::Clear(ui::Clipboard::Buffer buffer) { | 45 void SimpleClipboardClient::Clear(ui::Clipboard::Buffer buffer) { |
46 GetClipboard()->Clear(buffer); | 46 GetClipboard()->Clear(buffer); |
47 } | 47 } |
48 | 48 |
49 void SimpleClipboardClient::ReadAvailableTypes(ui::Clipboard::Buffer buffer, | 49 void SimpleClipboardClient::ReadAvailableTypes( |
50 std::vector<string16>* types, | 50 ui::Clipboard::Buffer buffer, |
51 bool* contains_filenames) { | 51 std::vector<base::string16>* types, |
52 return GetClipboard()->ReadAvailableTypes(buffer, types, | 52 bool* contains_filenames) { |
53 contains_filenames); | 53 return GetClipboard()->ReadAvailableTypes(buffer, types, contains_filenames); |
54 } | 54 } |
55 | 55 |
56 void SimpleClipboardClient::ReadText(ui::Clipboard::Buffer buffer, | 56 void SimpleClipboardClient::ReadText(ui::Clipboard::Buffer buffer, |
57 string16* result) { | 57 base::string16* result) { |
58 GetClipboard()->ReadText(buffer, result); | 58 GetClipboard()->ReadText(buffer, result); |
59 } | 59 } |
60 | 60 |
61 void SimpleClipboardClient::ReadAsciiText(ui::Clipboard::Buffer buffer, | 61 void SimpleClipboardClient::ReadAsciiText(ui::Clipboard::Buffer buffer, |
62 std::string* result) { | 62 std::string* result) { |
63 GetClipboard()->ReadAsciiText(buffer, result); | 63 GetClipboard()->ReadAsciiText(buffer, result); |
64 } | 64 } |
65 | 65 |
66 void SimpleClipboardClient::ReadHTML(ui::Clipboard::Buffer buffer, | 66 void SimpleClipboardClient::ReadHTML(ui::Clipboard::Buffer buffer, |
67 string16* markup, | 67 base::string16* markup, |
68 GURL* url, uint32* fragment_start, | 68 GURL* url, uint32* fragment_start, |
69 uint32* fragment_end) { | 69 uint32* fragment_end) { |
70 std::string url_str; | 70 std::string url_str; |
71 GetClipboard()->ReadHTML(buffer, markup, url ? &url_str : NULL, | 71 GetClipboard()->ReadHTML(buffer, markup, url ? &url_str : NULL, |
72 fragment_start, fragment_end); | 72 fragment_start, fragment_end); |
73 if (url) | 73 if (url) |
74 *url = GURL(url_str); | 74 *url = GURL(url_str); |
75 } | 75 } |
76 | 76 |
77 void SimpleClipboardClient::ReadRTF(ui::Clipboard::Buffer buffer, | 77 void SimpleClipboardClient::ReadRTF(ui::Clipboard::Buffer buffer, |
(...skipping 17 matching lines...) Expand all Loading... |
95 false, | 95 false, |
96 std::vector<gfx::PNGCodec::Comment>(), | 96 std::vector<gfx::PNGCodec::Comment>(), |
97 Z_BEST_SPEED, | 97 Z_BEST_SPEED, |
98 &png_data)) { | 98 &png_data)) { |
99 data->assign(reinterpret_cast<char*>(vector_as_array(&png_data)), | 99 data->assign(reinterpret_cast<char*>(vector_as_array(&png_data)), |
100 png_data.size()); | 100 png_data.size()); |
101 } | 101 } |
102 } | 102 } |
103 | 103 |
104 void SimpleClipboardClient::ReadCustomData(ui::Clipboard::Buffer buffer, | 104 void SimpleClipboardClient::ReadCustomData(ui::Clipboard::Buffer buffer, |
105 const string16& type, | 105 const base::string16& type, |
106 string16* data) { | 106 base::string16* data) { |
107 GetClipboard()->ReadCustomData(buffer, type, data); | 107 GetClipboard()->ReadCustomData(buffer, type, data); |
108 } | 108 } |
109 | 109 |
110 void SimpleClipboardClient::ReadData(const ui::Clipboard::FormatType& format, | 110 void SimpleClipboardClient::ReadData(const ui::Clipboard::FormatType& format, |
111 std::string* data) { | 111 std::string* data) { |
112 GetClipboard()->ReadData(format, data); | 112 GetClipboard()->ReadData(format, data); |
113 } | 113 } |
114 | 114 |
115 webkit_glue::ClipboardClient::WriteContext* | 115 webkit_glue::ClipboardClient::WriteContext* |
116 SimpleClipboardClient::CreateWriteContext() { | 116 SimpleClipboardClient::CreateWriteContext() { |
117 return NULL; | 117 return NULL; |
118 } | 118 } |
OLD | NEW |