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 #include "ppapi/c/pp_errors.h" | 5 #include "ppapi/c/pp_errors.h" |
6 #include "ppapi/c/private/ppb_flash_clipboard.h" | 6 #include "ppapi/c/private/ppb_flash_clipboard.h" |
7 #include "ppapi/thunk/enter.h" | 7 #include "ppapi/thunk/enter.h" |
8 #include "ppapi/thunk/thunk.h" | 8 #include "ppapi/thunk/thunk.h" |
9 #include "ppapi/thunk/ppb_flash_clipboard_api.h" | 9 #include "ppapi/thunk/ppb_flash_clipboard_api.h" |
10 | 10 |
(...skipping 23 matching lines...) Expand all Loading... |
34 | 34 |
35 int32_t WritePlainText(PP_Instance instance, | 35 int32_t WritePlainText(PP_Instance instance, |
36 PP_Flash_Clipboard_Type clipboard_type, | 36 PP_Flash_Clipboard_Type clipboard_type, |
37 PP_Var text) { | 37 PP_Var text) { |
38 EnterFlashClipboard enter(instance, true); | 38 EnterFlashClipboard enter(instance, true); |
39 if (enter.failed()) | 39 if (enter.failed()) |
40 return enter.retval(); | 40 return enter.retval(); |
41 return enter.functions()->WritePlainText(instance, clipboard_type, text); | 41 return enter.functions()->WritePlainText(instance, clipboard_type, text); |
42 } | 42 } |
43 | 43 |
44 const PPB_Flash_Clipboard g_ppb_flash_clipboard_thunk = { | 44 PP_Var ReadData(PP_Instance instance, |
| 45 PP_Flash_Clipboard_Type clipboard_type, |
| 46 PP_Flash_Clipboard_Format format) { |
| 47 EnterFlashClipboard enter(instance, true); |
| 48 if (enter.failed()) |
| 49 return PP_MakeUndefined(); |
| 50 return enter.functions()->ReadData(instance, clipboard_type, format); |
| 51 } |
| 52 |
| 53 int32_t WriteData(PP_Instance instance, |
| 54 PP_Flash_Clipboard_Type clipboard_type, |
| 55 uint32_t data_item_count, |
| 56 const struct PP_Flash_Clipboard_Data_Item data_items[]) { |
| 57 EnterFlashClipboard enter(instance, true); |
| 58 if (enter.failed()) |
| 59 return PP_ERROR_NOINTERFACE; |
| 60 return enter.functions()->WriteData(instance, clipboard_type, data_item_count, |
| 61 data_items); |
| 62 } |
| 63 |
| 64 const PPB_Flash_Clipboard_3_0 g_ppb_flash_clipboard_thunk_3_0 = { |
45 &IsFormatAvailable, | 65 &IsFormatAvailable, |
46 &ReadPlainText, | 66 &ReadPlainText, |
47 &WritePlainText | 67 &WritePlainText |
48 }; | 68 }; |
49 | 69 |
| 70 const PPB_Flash_Clipboard_4_0 g_ppb_flash_clipboard_thunk_4_0 = { |
| 71 &IsFormatAvailable, |
| 72 &ReadData, |
| 73 &WriteData |
| 74 }; |
| 75 |
50 } // namespace | 76 } // namespace |
51 | 77 |
52 const PPB_Flash_Clipboard_3_0* GetPPB_Flash_Clipboard_3_0_Thunk() { | 78 const PPB_Flash_Clipboard_3_0* GetPPB_Flash_Clipboard_3_0_Thunk() { |
53 return &g_ppb_flash_clipboard_thunk; | 79 return &g_ppb_flash_clipboard_thunk_3_0; |
| 80 } |
| 81 |
| 82 const PPB_Flash_Clipboard_4_0* GetPPB_Flash_Clipboard_4_0_Thunk() { |
| 83 return &g_ppb_flash_clipboard_thunk_4_0; |
54 } | 84 } |
55 | 85 |
56 } // namespace thunk | 86 } // namespace thunk |
57 } // namespace ppapi | 87 } // namespace ppapi |
OLD | NEW |