| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 PPAPI_CPP_PRIVATE_FLASH_CLIPBOARD_H_ | 5 #ifndef PPAPI_CPP_PRIVATE_FLASH_CLIPBOARD_H_ |
| 6 #define PPAPI_CPP_PRIVATE_FLASH_CLIPBOARD_H_ | 6 #define PPAPI_CPP_PRIVATE_FLASH_CLIPBOARD_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> |
| 9 | 10 |
| 10 #include "ppapi/c/private/ppb_flash_clipboard.h" | 11 #include "ppapi/c/private/ppb_flash_clipboard.h" |
| 12 #include "ppapi/cpp/var.h" |
| 11 | 13 |
| 12 namespace pp { | 14 namespace pp { |
| 13 | 15 |
| 14 class Instance; | 16 class Instance; |
| 15 | 17 |
| 16 namespace flash { | 18 namespace flash { |
| 17 | 19 |
| 18 class Clipboard { | 20 class Clipboard { |
| 19 public: | 21 public: |
| 20 // Returns true if the required interface is available. | 22 // Returns true if the required interface is available. |
| 21 static bool IsAvailable(); | 23 static bool IsAvailable(); |
| 22 | 24 |
| 23 // Returns true if the given format is available from the given clipboard. | 25 // Returns true if the given format is available from the given clipboard. |
| 24 static bool IsFormatAvailable(Instance* instance, | 26 static bool IsFormatAvailable(Instance* instance, |
| 25 PP_Flash_Clipboard_Type clipboard_type, | 27 PP_Flash_Clipboard_Type clipboard_type, |
| 26 PP_Flash_Clipboard_Format format); | 28 PP_Flash_Clipboard_Format format); |
| 27 | 29 |
| 28 // Returns true on success, in which case |text_out| will be filled with plain | 30 // Returns true on success, in which case |out| will be filled with |
| 29 // text read from the given clipboard. | 31 // data read from the given clipboard in the given format. |
| 30 static bool ReadPlainText(Instance* instance, | 32 static bool ReadData(Instance* instance, |
| 31 PP_Flash_Clipboard_Type clipboard_type, | 33 PP_Flash_Clipboard_Type clipboard_type, |
| 32 std::string* text_out); | 34 PP_Flash_Clipboard_Format clipboard_format, |
| 35 Var* out); |
| 33 | 36 |
| 34 // Returns true on success (it may fail if |text| is too big). | 37 // Returns true on success in which case all of |data| will be written to |
| 35 static bool WritePlainText(Instance* instance, | 38 // the clipboard. Otherwise nothing will be written. |
| 36 PP_Flash_Clipboard_Type clipboard_type, | 39 static bool WriteData(Instance* instance, |
| 37 const std::string& text); | 40 PP_Flash_Clipboard_Type clipboard_type, |
| 41 const std::vector<PP_Flash_Clipboard_Format>& formats, |
| 42 const std::vector<Var>& data_items); |
| 38 }; | 43 }; |
| 39 | 44 |
| 40 } // namespace flash | 45 } // namespace flash |
| 41 } // namespace pp | 46 } // namespace pp |
| 42 | 47 |
| 43 #endif // PPAPI_CPP_PRIVATE_FLASH_CLIPBOARD_H_ | 48 #endif // PPAPI_CPP_PRIVATE_FLASH_CLIPBOARD_H_ |
| OLD | NEW |