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" |
11 | 12 |
12 namespace pp { | 13 namespace pp { |
13 | 14 |
14 class Instance; | 15 class Instance; |
15 | 16 |
16 namespace flash { | 17 namespace flash { |
17 | 18 |
18 class Clipboard { | 19 class Clipboard { |
19 public: | 20 public: |
20 // Returns true if the required interface is available. | 21 // Returns true if the required interface is available. |
21 static bool IsAvailable(); | 22 static bool IsAvailable(); |
22 | 23 |
23 // Returns true if the given format is available from the given clipboard. | 24 // Returns true if the given format is available from the given clipboard. |
24 static bool IsFormatAvailable(Instance* instance, | 25 static bool IsFormatAvailable(Instance* instance, |
25 PP_Flash_Clipboard_Type clipboard_type, | 26 PP_Flash_Clipboard_Type clipboard_type, |
26 PP_Flash_Clipboard_Format format); | 27 PP_Flash_Clipboard_Format format); |
27 | 28 |
28 // Returns true on success, in which case |text_out| will be filled with plain | 29 // Returns true on success, in which case |out| will be filled with |
29 // text read from the given clipboard. | 30 // data read from the given clipboard in the given format. |
30 static bool ReadPlainText(Instance* instance, | 31 static bool ReadData(Instance* instance, |
31 PP_Flash_Clipboard_Type clipboard_type, | 32 PP_Flash_Clipboard_Type clipboard_type, |
32 std::string* text_out); | 33 PP_Flash_Clipboard_Format clipboard_format, |
34 PP_Var* out); | |
dmichael (off chromium)
2012/02/23 18:13:25
why not use pp::Var?
raymes
2012/02/24 07:28:28
Done.
| |
33 | 35 |
34 // Returns true on success (it may fail if |text| is too big). | 36 // Returns true on success in which case all of |data| will be written to |
35 static bool WritePlainText(Instance* instance, | 37 // the clipboard. Otherwise nothing will be written. |
36 PP_Flash_Clipboard_Type clipboard_type, | 38 static bool WriteData(Instance* instance, |
37 const std::string& text); | 39 PP_Flash_Clipboard_Type clipboard_type, |
40 const std::vector<PP_Flash_Clipboard_Data_Item>& data); | |
dmichael (off chromium)
2012/02/23 18:13:25
Similarly, it might be better to use pp::Var so th
raymes
2012/02/24 07:28:28
Thanks, I understand the ref counting better now.
| |
38 }; | 41 }; |
39 | 42 |
40 } // namespace flash | 43 } // namespace flash |
41 } // namespace pp | 44 } // namespace pp |
42 | 45 |
43 #endif // PPAPI_CPP_PRIVATE_FLASH_CLIPBOARD_H_ | 46 #endif // PPAPI_CPP_PRIVATE_FLASH_CLIPBOARD_H_ |
OLD | NEW |