Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef UI_BASE_TEST_FAKE_CLIPBOARD_H_ | |
| 6 #define UI_BASE_TEST_FAKE_CLIPBOARD_H_ | |
| 7 | |
| 8 #include <map> | |
| 9 #include "third_party/skia/include/core/SkBitmap.h" | |
| 10 #include "ui/base/clipboard/clipboard.h" | |
| 11 | |
| 12 namespace ui { | |
| 13 | |
| 14 class FakeClipboard : public Clipboard { | |
|
sky
2014/11/14 02:10:31
TestClipboard.
dcheng
2014/11/14 03:30:29
Done.
| |
| 15 public: | |
| 16 FakeClipboard(); | |
| 17 ~FakeClipboard() override; | |
| 18 | |
| 19 // Clipboard overrides. | |
| 20 uint64 GetSequenceNumber(ClipboardType type) const override; | |
| 21 bool IsFormatAvailable(const FormatType& format, | |
| 22 ClipboardType type) const override; | |
| 23 void Clear(ClipboardType type) override; | |
| 24 void ReadAvailableTypes(ClipboardType type, | |
| 25 std::vector<base::string16>* types, | |
| 26 bool* contains_filenames) const override; | |
| 27 void ReadText(ClipboardType type, base::string16* result) const override; | |
| 28 void ReadAsciiText(ClipboardType type, std::string* result) const override; | |
| 29 void ReadHTML(ClipboardType type, | |
| 30 base::string16* markup, | |
| 31 std::string* src_url, | |
| 32 uint32* fragment_start, | |
| 33 uint32* fragment_end) const override; | |
| 34 void ReadRTF(ClipboardType type, std::string* result) const override; | |
| 35 SkBitmap ReadImage(ClipboardType type) const override; | |
| 36 void ReadCustomData(ClipboardType clipboard_type, | |
| 37 const base::string16& type, | |
| 38 base::string16* result) const override; | |
| 39 void ReadBookmark(base::string16* title, std::string* url) const override; | |
| 40 void ReadData(const FormatType& format, std::string* result) const override; | |
| 41 void WriteObjects(ClipboardType type, const ObjectMap& objects) override; | |
| 42 void WriteText(const char* text_data, size_t text_len) override; | |
| 43 void WriteHTML(const char* markup_data, | |
| 44 size_t markup_len, | |
| 45 const char* url_data, | |
| 46 size_t url_len) override; | |
| 47 void WriteRTF(const char* rtf_data, size_t data_len) override; | |
| 48 void WriteBookmark(const char* title_data, | |
| 49 size_t title_len, | |
| 50 const char* url_data, | |
| 51 size_t url_len) override; | |
| 52 void WriteWebSmartPaste() override; | |
| 53 void WriteBitmap(const SkBitmap& bitmap) override; | |
| 54 void WriteData(const FormatType& format, | |
| 55 const char* data_data, | |
| 56 size_t data_len) override; | |
| 57 | |
| 58 private: | |
| 59 struct DataStore { | |
| 60 DataStore(); | |
| 61 ~DataStore(); | |
| 62 void Clear(); | |
| 63 uint64 sequence_number; | |
| 64 std::map<FormatType, std::string> data; | |
| 65 std::string url_title; | |
| 66 SkBitmap image; | |
| 67 }; | |
| 68 | |
| 69 // The non-const versions increment the sequence number as a side effect. | |
| 70 const DataStore& GetStore(ClipboardType type) const; | |
| 71 const DataStore& GetDefaultStore() const; | |
| 72 DataStore& GetStore(ClipboardType type); | |
| 73 DataStore& GetDefaultStore(); | |
| 74 | |
| 75 ClipboardType default_store_type_; | |
| 76 mutable std::map<ClipboardType, DataStore> stores_; | |
| 77 }; | |
|
sky
2014/11/14 02:10:31
DISALLOW...
dcheng
2014/11/14 03:30:28
Done.
| |
| 78 | |
| 79 } // namespace ui | |
| 80 | |
| 81 #endif // UI_BASE_TEST_FAKE_CLIPBOARD_H_ | |
| OLD | NEW |