Chromium Code Reviews| Index: ppapi/cpp/private/flash_clipboard.h |
| diff --git a/ppapi/cpp/private/flash_clipboard.h b/ppapi/cpp/private/flash_clipboard.h |
| index db13ce67c8d1952e883d35330eed45576bfc9d9e..09e197054938f987e2253c92b808598cf34ce3d9 100644 |
| --- a/ppapi/cpp/private/flash_clipboard.h |
| +++ b/ppapi/cpp/private/flash_clipboard.h |
| @@ -15,6 +15,24 @@ class Instance; |
| namespace flash { |
| +class ClipboardData { |
|
viettrungluu
2012/02/06 21:29:29
This seems like overkill to me. I'd just use an st
raymes
2012/02/07 00:02:25
Done.
|
| + public: |
| + static const uint32_t kMaxFormats = 3; |
| + |
| + void SetPlainText(const std::string& text); |
| + void SetHTML(const std::string& html); |
| + void Clear(); |
| + PP_Flash_Clipboard_Data_Item const* |
| + GetDataItems(uint32_t* data_item_count_out) const; |
| + |
| + private: |
| + uint32_t GetFormatIndex(PP_Flash_Clipboard_Format format); |
| + void SetTextVar(const std::string& text, PP_Flash_Clipboard_Format format); |
| + |
| + PP_Flash_Clipboard_Data_Item data_items_[kMaxFormats]; |
| + uint32_t data_item_count_; |
| +}; |
| + |
| class Clipboard { |
| public: |
| // Returns true if the required interface is available. |
| @@ -31,10 +49,25 @@ class Clipboard { |
| PP_Flash_Clipboard_Type clipboard_type, |
| std::string* text_out); |
| - // Returns true on success (it may fail if |text| is too big). |
| - static bool WritePlainText(Instance* instance, |
|
viettrungluu
2012/02/06 21:29:29
You should keep this (and also ReadPlainText()) te
raymes
2012/02/07 00:02:25
Done.
|
| - PP_Flash_Clipboard_Type clipboard_type, |
| - const std::string& text); |
| + // Returns true on success, in which case |html_out| will be filled with html |
|
viettrungluu
2012/02/06 21:29:29
I'd just implement a ReadData() that parallels the
raymes
2012/02/07 00:02:25
Done.
|
| + // text read from the given clipboard. |
| + static bool ReadHTML(Instance* instance, |
| + PP_Flash_Clipboard_Type clipboard_type, |
| + std::string* html_out); |
| + |
| + |
| + // Returns true on success in which case all of |data| will be written to |
| + // the clipboard. Otherwise nothing will be written. |
| + static bool WriteData(Instance* instance, |
| + PP_Flash_Clipboard_Type clipboard_type, |
| + const ClipboardData& data); |
| + |
| + private: |
| + // Helper method for writing strings to the clipboard. |
| + static bool ReadTextVar(Instance*, |
| + PP_Flash_Clipboard_Type clipboard_type, |
| + PP_Flash_Clipboard_Format clipboard_format, |
| + std::string* text_out); |
| }; |
| } // namespace flash |