Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: ppapi/thunk/ppb_flash_clipboard_thunk.cc

Issue 8365017: Convert the flash clipboard API to thunk system. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ppapi/c/pp_errors.h"
6 #include "ppapi/c/private/ppb_flash_clipboard.h"
7 #include "ppapi/thunk/enter.h"
8 #include "ppapi/thunk/thunk.h"
9 #include "ppapi/thunk/ppb_flash_clipboard_api.h"
10
11 namespace ppapi {
12 namespace thunk {
13
14 namespace {
15
16 typedef EnterFunction<PPB_Flash_Clipboard_FunctionAPI> EnterFlashClipboard;
17
18 PP_Bool IsFormatAvailable(PP_Instance instance,
19 PP_Flash_Clipboard_Type clipboard_type,
20 PP_Flash_Clipboard_Format format) {
21 EnterFlashClipboard enter(instance, true);
22 if (enter.failed())
23 return PP_FALSE;
24 return enter.functions()->IsFormatAvailable(instance, clipboard_type, format);
25 }
26
27 PP_Var ReadPlainText(PP_Instance instance,
28 PP_Flash_Clipboard_Type clipboard_type) {
29 EnterFlashClipboard enter(instance, true);
30 if (enter.failed())
31 return PP_MakeUndefined();
32 return enter.functions()->ReadPlainText(instance, clipboard_type);
33 }
34
35 int32_t WritePlainText(PP_Instance instance,
36 PP_Flash_Clipboard_Type clipboard_type,
37 PP_Var text) {
38 EnterFlashClipboard enter(instance, true);
39 if (enter.failed())
40 return PP_ERROR_NOINTERFACE;
viettrungluu 2011/10/20 23:41:01 Is PP_ERROR_NOINTERFACE really correct here?
brettw 2011/10/21 20:09:03 It seems as correct as "general error". The happen
41 return enter.functions()->WritePlainText(instance, clipboard_type, text);
42 }
43
44 const PPB_Flash_Clipboard g_ppb_flash_clipboard_thunk = {
45 &IsFormatAvailable,
46 &ReadPlainText,
47 &WritePlainText
48 };
49
50 } // namespace
51
52 const PPB_Flash_Clipboard* GetPPB_Flash_Clipboard_Thunk() {
53 return &g_ppb_flash_clipboard_thunk;
54 }
55
56 } // namespace thunk
57 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698