| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/base/test/test_clipboard.h" | 5 #include "ui/base/test/test_clipboard.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include "base/numerics/safe_conversions.h" | 8 #include "base/numerics/safe_conversions.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 | 10 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 return store.data.find(format) != store.data.end(); | 35 return store.data.find(format) != store.data.end(); |
| 36 } | 36 } |
| 37 | 37 |
| 38 void TestClipboard::Clear(ClipboardType type) { | 38 void TestClipboard::Clear(ClipboardType type) { |
| 39 GetStore(type).Clear(); | 39 GetStore(type).Clear(); |
| 40 } | 40 } |
| 41 | 41 |
| 42 void TestClipboard::ReadAvailableTypes(ClipboardType type, | 42 void TestClipboard::ReadAvailableTypes(ClipboardType type, |
| 43 std::vector<base::string16>* types, | 43 std::vector<base::string16>* types, |
| 44 bool* contains_filenames) const { | 44 bool* contains_filenames) const { |
| 45 types->clear(); |
| 46 |
| 47 if (IsFormatAvailable(Clipboard::GetPlainTextFormatType(), type)) |
| 48 types->push_back(base::UTF8ToUTF16(kMimeTypeText)); |
| 49 if (IsFormatAvailable(Clipboard::GetHtmlFormatType(), type)) |
| 50 types->push_back(base::UTF8ToUTF16(kMimeTypeHTML)); |
| 51 |
| 52 if (IsFormatAvailable(Clipboard::GetRtfFormatType(), type)) |
| 53 types->push_back(base::UTF8ToUTF16(kMimeTypeRTF)); |
| 54 if (IsFormatAvailable(Clipboard::GetBitmapFormatType(), type)) |
| 55 types->push_back(base::UTF8ToUTF16(kMimeTypePNG)); |
| 56 |
| 45 *contains_filenames = false; | 57 *contains_filenames = false; |
| 46 } | 58 } |
| 47 | 59 |
| 48 void TestClipboard::ReadText(ClipboardType type, base::string16* result) const { | 60 void TestClipboard::ReadText(ClipboardType type, base::string16* result) const { |
| 49 std::string result8; | 61 std::string result8; |
| 50 ReadAsciiText(type, &result8); | 62 ReadAsciiText(type, &result8); |
| 51 *result = base::UTF8ToUTF16(result8); | 63 *result = base::UTF8ToUTF16(result8); |
| 52 } | 64 } |
| 53 | 65 |
| 54 void TestClipboard::ReadAsciiText(ClipboardType type, | 66 void TestClipboard::ReadAsciiText(ClipboardType type, |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 | 207 |
| 196 const TestClipboard::DataStore& TestClipboard::GetDefaultStore() const { | 208 const TestClipboard::DataStore& TestClipboard::GetDefaultStore() const { |
| 197 return GetStore(default_store_type_); | 209 return GetStore(default_store_type_); |
| 198 } | 210 } |
| 199 | 211 |
| 200 TestClipboard::DataStore& TestClipboard::GetDefaultStore() { | 212 TestClipboard::DataStore& TestClipboard::GetDefaultStore() { |
| 201 return GetStore(default_store_type_); | 213 return GetStore(default_store_type_); |
| 202 } | 214 } |
| 203 | 215 |
| 204 } // namespace ui | 216 } // namespace ui |
| OLD | NEW |