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

Unified Diff: ppapi/thunk/ppb_alarms_dev_thunk.cc

Issue 60173003: Draft: apps APIs in Pepper (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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
« no previous file with comments | « ppapi/thunk/interfaces_ppb_public_dev.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/thunk/ppb_alarms_dev_thunk.cc
diff --git a/ppapi/thunk/ppb_alarms_dev_thunk.cc b/ppapi/thunk/ppb_alarms_dev_thunk.cc
new file mode 100644
index 0000000000000000000000000000000000000000..ab08b4795efccf1175767e9828f2bac2ec2dacd9
--- /dev/null
+++ b/ppapi/thunk/ppb_alarms_dev_thunk.cc
@@ -0,0 +1,101 @@
+// Copyright (c) 2013 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 <vector>
+
+#include "ppapi/c/dev/ppb_alarms_dev.h"
+#include "ppapi/shared_impl/proxy_lock.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/shared_impl/var.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/extensions_common_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+void Create(PP_Instance instance,
+ PP_Var name,
+ const PP_Alarms_AlarmCreateInfo_Dev* alarm_info) {
+ ProxyAutoLock lock;
+ std::string a = StringVar::FromPPVar(name)->value();
+}
+
+int32_t Get(PP_Instance instance,
+ PP_Var name,
+ PP_Alarms_Alarm_Dev* alarm,
+ PP_CompletionCallback callback) {
+ EnterInstanceAPI<ExtensionsCommon_API> enter(instance, callback);
+ if (enter.failed())
+ return enter.retval();
+
+ std::string a = StringVar::FromPPVar(name)->value();
+ alarm->name = StringVar::StringToPPVar(a);
+ alarm->scheduled_time = 1;
+ alarm->period_in_minutes.is_set = PP_FALSE;
+
+ return enter.SetResult(PP_OK);
+}
+
+int32_t GetAll(PP_Instance instance,
+ PP_Alarms_Alarm_Array_Dev* alarms,
+ PP_ArrayOutput array_allocator,
+ PP_CompletionCallback callback) {
+ EnterInstanceAPI<ExtensionsCommon_API> enter(instance, callback);
+ if (enter.failed())
+ return enter.retval();
+
+ alarms->elements =
+ static_cast<PP_Alarms_Alarm_Dev*>(array_allocator.GetDataBuffer(
+ array_allocator.user_data,
+ 2,
+ sizeof(PP_Alarms_Alarm_Dev)));
+ alarms->size = 2;
+
+ alarms->elements[0].name = StringVar::StringToPPVar("abc");
+ alarms->elements[0].scheduled_time = 1;
+ alarms->elements[0].period_in_minutes.is_set = PP_TRUE;
+ alarms->elements[0].period_in_minutes.value = 3;
+
+ alarms->elements[1].name = StringVar::StringToPPVar("def");
+ alarms->elements[1].scheduled_time = 4;
+ alarms->elements[1].period_in_minutes.is_set = PP_FALSE;
+ alarms->elements[1].period_in_minutes.value = 0;
+
+ return enter.SetResult(PP_OK);
+}
+
+void Clear(PP_Instance instance, PP_Var name) {
+ ProxyAutoLock lock;
+ std::string a = StringVar::FromPPVar(name)->value();
+}
+
+void ClearAll(PP_Instance instance) {
+}
+
+uint32_t AddOnAlarmListener(PP_Instance instance,
+ PP_Alarms_OnAlarm_Dev callback,
+ void* user_data) {
+ return 0;
+}
+
+const PPB_Alarms_Dev_0_1 g_ppb_alarms_dev_0_1_thunk = {
+ &Create,
+ &Get,
+ &GetAll,
+ &Clear,
+ &ClearAll,
+ &AddOnAlarmListener
+};
+
+} // namespace
+
+const PPB_Alarms_Dev_0_1* GetPPB_Alarms_Dev_0_1_Thunk() {
+ return &g_ppb_alarms_dev_0_1_thunk;
+}
+
+} // namespace thunk
+} // namespace ppapi
« no previous file with comments | « ppapi/thunk/interfaces_ppb_public_dev.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698