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_api.h" |
10 | 10 |
11 namespace ppapi { | 11 namespace ppapi { |
12 namespace thunk { | 12 namespace thunk { |
13 | 13 |
14 namespace { | 14 namespace { |
15 | 15 |
16 typedef EnterFunction<PPB_Flash_Clipboard_FunctionAPI> EnterFlashClipboard; | |
17 | |
18 PP_Bool IsFormatAvailable(PP_Instance instance, | 16 PP_Bool IsFormatAvailable(PP_Instance instance, |
19 PP_Flash_Clipboard_Type clipboard_type, | 17 PP_Flash_Clipboard_Type clipboard_type, |
20 PP_Flash_Clipboard_Format format) { | 18 PP_Flash_Clipboard_Format format) { |
21 EnterFlashClipboard enter(instance, true); | 19 EnterInstance enter(instance); |
22 if (enter.failed()) | 20 if (enter.failed()) |
23 return PP_FALSE; | 21 return PP_FALSE; |
24 return enter.functions()->IsFormatAvailable(instance, clipboard_type, format); | 22 return enter.functions()->GetFlashAPI()->IsClipboardFormatAvailable( |
| 23 instance, clipboard_type, format); |
25 } | 24 } |
26 | 25 |
27 PP_Var ReadData(PP_Instance instance, | 26 PP_Var ReadData(PP_Instance instance, |
28 PP_Flash_Clipboard_Type clipboard_type, | 27 PP_Flash_Clipboard_Type clipboard_type, |
29 PP_Flash_Clipboard_Format format) { | 28 PP_Flash_Clipboard_Format format) { |
30 EnterFlashClipboard enter(instance, true); | 29 EnterInstance enter(instance); |
31 if (enter.failed()) | 30 if (enter.failed()) |
32 return PP_MakeUndefined(); | 31 return PP_MakeUndefined(); |
33 return enter.functions()->ReadData(instance, clipboard_type, format); | 32 return enter.functions()->GetFlashAPI()->ReadClipboardData( |
| 33 instance, clipboard_type, format); |
34 } | 34 } |
35 | 35 |
36 int32_t WriteData(PP_Instance instance, | 36 int32_t WriteData(PP_Instance instance, |
37 PP_Flash_Clipboard_Type clipboard_type, | 37 PP_Flash_Clipboard_Type clipboard_type, |
38 uint32_t data_item_count, | 38 uint32_t data_item_count, |
39 const PP_Flash_Clipboard_Format formats[], | 39 const PP_Flash_Clipboard_Format formats[], |
40 const PP_Var data_items[]) { | 40 const PP_Var data_items[]) { |
41 EnterFlashClipboard enter(instance, true); | 41 EnterInstance enter(instance); |
42 if (enter.failed()) | 42 if (enter.failed()) |
43 return enter.retval(); | 43 return enter.retval(); |
44 return enter.functions()->WriteData(instance, | 44 return enter.functions()->GetFlashAPI()->WriteClipboardData( |
45 clipboard_type, | 45 instance, clipboard_type, data_item_count, formats, data_items); |
46 data_item_count, | |
47 formats, | |
48 data_items); | |
49 } | 46 } |
50 | 47 |
51 PP_Var ReadPlainText(PP_Instance instance, | 48 PP_Var ReadPlainText(PP_Instance instance, |
52 PP_Flash_Clipboard_Type clipboard_type) { | 49 PP_Flash_Clipboard_Type clipboard_type) { |
53 return ReadData(instance, | 50 return ReadData(instance, |
54 clipboard_type, | 51 clipboard_type, |
55 PP_FLASH_CLIPBOARD_FORMAT_PLAINTEXT); | 52 PP_FLASH_CLIPBOARD_FORMAT_PLAINTEXT); |
56 } | 53 } |
57 | 54 |
58 int32_t WritePlainText(PP_Instance instance, | 55 int32_t WritePlainText(PP_Instance instance, |
(...skipping 20 matching lines...) Expand all Loading... |
79 const PPB_Flash_Clipboard_3_0* GetPPB_Flash_Clipboard_3_0_Thunk() { | 76 const PPB_Flash_Clipboard_3_0* GetPPB_Flash_Clipboard_3_0_Thunk() { |
80 return &g_ppb_flash_clipboard_thunk_3_0; | 77 return &g_ppb_flash_clipboard_thunk_3_0; |
81 } | 78 } |
82 | 79 |
83 const PPB_Flash_Clipboard_4_0* GetPPB_Flash_Clipboard_4_0_Thunk() { | 80 const PPB_Flash_Clipboard_4_0* GetPPB_Flash_Clipboard_4_0_Thunk() { |
84 return &g_ppb_flash_clipboard_thunk_4_0; | 81 return &g_ppb_flash_clipboard_thunk_4_0; |
85 } | 82 } |
86 | 83 |
87 } // namespace thunk | 84 } // namespace thunk |
88 } // namespace ppapi | 85 } // namespace ppapi |
OLD | NEW |