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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: ppapi/thunk/ppb_flash_clipboard_thunk.cc
diff --git a/ppapi/thunk/ppb_flash_clipboard_thunk.cc b/ppapi/thunk/ppb_flash_clipboard_thunk.cc
new file mode 100644
index 0000000000000000000000000000000000000000..010aa2f8bb055a0026e2963d3ce81920bd054ada
--- /dev/null
+++ b/ppapi/thunk/ppb_flash_clipboard_thunk.cc
@@ -0,0 +1,57 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/private/ppb_flash_clipboard.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/thunk.h"
+#include "ppapi/thunk/ppb_flash_clipboard_api.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+typedef EnterFunction<PPB_Flash_Clipboard_FunctionAPI> EnterFlashClipboard;
+
+PP_Bool IsFormatAvailable(PP_Instance instance,
+ PP_Flash_Clipboard_Type clipboard_type,
+ PP_Flash_Clipboard_Format format) {
+ EnterFlashClipboard enter(instance, true);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.functions()->IsFormatAvailable(instance, clipboard_type, format);
+}
+
+PP_Var ReadPlainText(PP_Instance instance,
+ PP_Flash_Clipboard_Type clipboard_type) {
+ EnterFlashClipboard enter(instance, true);
+ if (enter.failed())
+ return PP_MakeUndefined();
+ return enter.functions()->ReadPlainText(instance, clipboard_type);
+}
+
+int32_t WritePlainText(PP_Instance instance,
+ PP_Flash_Clipboard_Type clipboard_type,
+ PP_Var text) {
+ EnterFlashClipboard enter(instance, true);
+ if (enter.failed())
+ 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
+ return enter.functions()->WritePlainText(instance, clipboard_type, text);
+}
+
+const PPB_Flash_Clipboard g_ppb_flash_clipboard_thunk = {
+ &IsFormatAvailable,
+ &ReadPlainText,
+ &WritePlainText
+};
+
+} // namespace
+
+const PPB_Flash_Clipboard* GetPPB_Flash_Clipboard_Thunk() {
+ return &g_ppb_flash_clipboard_thunk;
+}
+
+} // namespace thunk
+} // namespace ppapi

Powered by Google App Engine
This is Rietveld 408576698