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 #ifndef UI_BASE_TEST_TEST_CLIPBOARD_H_ | 5 #ifndef UI_BASE_TEST_TEST_CLIPBOARD_H_ |
6 #define UI_BASE_TEST_TEST_CLIPBOARD_H_ | 6 #define UI_BASE_TEST_TEST_CLIPBOARD_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include "third_party/skia/include/core/SkBitmap.h" | 9 #include "third_party/skia/include/core/SkBitmap.h" |
10 #include "ui/base/clipboard/clipboard.h" | 10 #include "ui/base/clipboard/clipboard.h" |
11 | 11 |
12 namespace ui { | 12 namespace ui { |
13 | 13 |
14 class TestClipboard : public Clipboard { | 14 class TestClipboard : public Clipboard { |
15 public: | 15 public: |
16 TestClipboard(); | 16 TestClipboard(); |
17 ~TestClipboard() override; | 17 ~TestClipboard() override; |
18 | 18 |
19 static void UseForCurrentThread(); | 19 // Creates and associates a TestClipboard with the current thread. When no |
| 20 // longer needed, the returned clipboard must be freed by calling |
| 21 // Clipboard::DestroyClipboardForCurrentThread() on the same thread. |
| 22 static Clipboard* CreateForCurrentThread(); |
20 | 23 |
21 // Clipboard overrides. | 24 // Clipboard overrides. |
22 uint64 GetSequenceNumber(ClipboardType type) const override; | 25 uint64 GetSequenceNumber(ClipboardType type) const override; |
23 bool IsFormatAvailable(const FormatType& format, | 26 bool IsFormatAvailable(const FormatType& format, |
24 ClipboardType type) const override; | 27 ClipboardType type) const override; |
25 void Clear(ClipboardType type) override; | 28 void Clear(ClipboardType type) override; |
26 void ReadAvailableTypes(ClipboardType type, | 29 void ReadAvailableTypes(ClipboardType type, |
27 std::vector<base::string16>* types, | 30 std::vector<base::string16>* types, |
28 bool* contains_filenames) const override; | 31 bool* contains_filenames) const override; |
29 void ReadText(ClipboardType type, base::string16* result) const override; | 32 void ReadText(ClipboardType type, base::string16* result) const override; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 | 80 |
78 ClipboardType default_store_type_; | 81 ClipboardType default_store_type_; |
79 mutable std::map<ClipboardType, DataStore> stores_; | 82 mutable std::map<ClipboardType, DataStore> stores_; |
80 | 83 |
81 DISALLOW_COPY_AND_ASSIGN(TestClipboard); | 84 DISALLOW_COPY_AND_ASSIGN(TestClipboard); |
82 }; | 85 }; |
83 | 86 |
84 } // namespace ui | 87 } // namespace ui |
85 | 88 |
86 #endif // UI_BASE_TEST_TEST_CLIPBOARD_H_ | 89 #endif // UI_BASE_TEST_TEST_CLIPBOARD_H_ |
OLD | NEW |