Index: ui/base/test/test_clipboard.h |
diff --git a/ui/base/clipboard/clipboard_win.h b/ui/base/test/test_clipboard.h |
similarity index 67% |
copy from ui/base/clipboard/clipboard_win.h |
copy to ui/base/test/test_clipboard.h |
index a0769ff8859ec6b9aaf10437bb3e5c63c5d46c1e..c1701bf72464242fe041bd3aa538d3b7a161fd67 100644 |
--- a/ui/base/clipboard/clipboard_win.h |
+++ b/ui/base/test/test_clipboard.h |
@@ -2,24 +2,24 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#ifndef UI_BASE_CLIPBOARD_CLIPBOARD_WIN_H_ |
-#define UI_BASE_CLIPBOARD_CLIPBOARD_WIN_H_ |
+#ifndef UI_BASE_TEST_TEST_CLIPBOARD_H_ |
+#define UI_BASE_TEST_TEST_CLIPBOARD_H_ |
+#include <map> |
+#include "third_party/skia/include/core/SkBitmap.h" |
#include "ui/base/clipboard/clipboard.h" |
-#include "base/memory/scoped_ptr.h" |
- |
namespace ui { |
-class ClipboardWin : public Clipboard { |
- private: |
- friend class Clipboard; |
+class TestClipboard : public Clipboard { |
+ public: |
+ TestClipboard(); |
+ ~TestClipboard() override; |
- ClipboardWin(); |
- ~ClipboardWin() override; |
+ static void UseForCurrentThread(); |
- // Clipboard overrides: |
- uint64 GetSequenceNumber(ClipboardType type) override; |
+ // Clipboard overrides. |
+ uint64 GetSequenceNumber(ClipboardType type) const override; |
bool IsFormatAvailable(const FormatType& format, |
ClipboardType type) const override; |
void Clear(ClipboardType type) override; |
@@ -57,21 +57,30 @@ class ClipboardWin : public Clipboard { |
const char* data_data, |
size_t data_len) override; |
- void WriteBitmapFromHandle(HBITMAP source_hbitmap, const gfx::Size& size); |
- |
- // Safely write to system clipboard. Free |handle| on failure. |
- void WriteToClipboard(unsigned int format, HANDLE handle); |
+ private: |
+ struct DataStore { |
+ DataStore(); |
+ ~DataStore(); |
+ void Clear(); |
+ uint64 sequence_number; |
+ std::map<FormatType, std::string> data; |
+ std::string url_title; |
+ std::string html_src_url; |
+ SkBitmap image; |
+ }; |
- // Return the window that should be the clipboard owner, creating it |
- // if neccessary. Marked const for lazily initialization by const methods. |
- HWND GetClipboardWindow() const; |
+ // The non-const versions increment the sequence number as a side effect. |
+ const DataStore& GetStore(ClipboardType type) const; |
+ const DataStore& GetDefaultStore() const; |
+ DataStore& GetStore(ClipboardType type); |
+ DataStore& GetDefaultStore(); |
- // Mark this as mutable so const methods can still do lazy initialization. |
- mutable scoped_ptr<base::win::MessageWindow> clipboard_owner_; |
+ ClipboardType default_store_type_; |
+ mutable std::map<ClipboardType, DataStore> stores_; |
- DISALLOW_COPY_AND_ASSIGN(ClipboardWin); |
+ DISALLOW_COPY_AND_ASSIGN(TestClipboard); |
}; |
} // namespace ui |
-#endif // UI_BASE_CLIPBOARD_CLIPBOARD_WIN_H_ |
+#endif // UI_BASE_TEST_TEST_CLIPBOARD_H_ |