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.
5 #ifndef UI_BASE_CLIPBOARD_CLIPBOARD_WIN_H_
6 #define UI_BASE_CLIPBOARD_CLIPBOARD_WIN_H_
8 #include "ui/base/clipboard/clipboard.h"
10 #include "base/memory/scoped_ptr.h"
14 class ClipboardWin
: public Clipboard
{
16 friend class Clipboard
;
19 ~ClipboardWin() override
;
21 // Clipboard overrides:
22 uint64
GetSequenceNumber(ClipboardType type
) const override
;
23 bool IsFormatAvailable(const FormatType
& format
,
24 ClipboardType type
) const override
;
25 void Clear(ClipboardType type
) override
;
26 void ReadAvailableTypes(ClipboardType type
,
27 std::vector
<base::string16
>* types
,
28 bool* contains_filenames
) const override
;
29 void ReadText(ClipboardType type
, base::string16
* result
) const override
;
30 void ReadAsciiText(ClipboardType type
, std::string
* result
) const override
;
31 void ReadHTML(ClipboardType type
,
32 base::string16
* markup
,
34 uint32
* fragment_start
,
35 uint32
* fragment_end
) const override
;
36 void ReadRTF(ClipboardType type
, std::string
* result
) const override
;
37 SkBitmap
ReadImage(ClipboardType type
) const override
;
38 void ReadCustomData(ClipboardType clipboard_type
,
39 const base::string16
& type
,
40 base::string16
* result
) const override
;
41 void ReadBookmark(base::string16
* title
, std::string
* url
) const override
;
42 void ReadData(const FormatType
& format
, std::string
* result
) const override
;
43 void WriteObjects(ClipboardType type
, const ObjectMap
& objects
) override
;
44 void WriteText(const char* text_data
, size_t text_len
) override
;
45 void WriteHTML(const char* markup_data
,
48 size_t url_len
) override
;
49 void WriteRTF(const char* rtf_data
, size_t data_len
) override
;
50 void WriteBookmark(const char* title_data
,
53 size_t url_len
) override
;
54 void WriteWebSmartPaste() override
;
55 void WriteBitmap(const SkBitmap
& bitmap
) override
;
56 void WriteData(const FormatType
& format
,
57 const char* data_data
,
58 size_t data_len
) override
;
60 void WriteBitmapFromHandle(HBITMAP source_hbitmap
, const gfx::Size
& size
);
62 // Safely write to system clipboard. Free |handle| on failure.
63 void WriteToClipboard(unsigned int format
, HANDLE handle
);
65 // Return the window that should be the clipboard owner, creating it
66 // if neccessary. Marked const for lazily initialization by const methods.
67 HWND
GetClipboardWindow() const;
69 // Mark this as mutable so const methods can still do lazy initialization.
70 mutable scoped_ptr
<base::win::MessageWindow
> clipboard_owner_
;
72 DISALLOW_COPY_AND_ASSIGN(ClipboardWin
);
77 #endif // UI_BASE_CLIPBOARD_CLIPBOARD_WIN_H_