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

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

Issue 15039008: Add browser resource host for Apps v2 APIs in Pepper. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 7 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
« no previous file with comments | « ppapi/thunk/extensions_common_api.h ('k') | ppapi/thunk/ppb_ext_socket_thunk.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 <vector> 5 #include <vector>
6 6
7 #include "ppapi/c/extensions/dev/ppb_ext_alarms_dev.h" 7 #include "ppapi/c/extensions/dev/ppb_ext_alarms_dev.h"
8 #include "ppapi/shared_impl/tracked_callback.h" 8 #include "ppapi/shared_impl/tracked_callback.h"
9 #include "ppapi/thunk/enter.h" 9 #include "ppapi/thunk/enter.h"
10 #include "ppapi/thunk/extensions_common_api.h" 10 #include "ppapi/thunk/extensions_common_api.h"
11 #include "ppapi/thunk/thunk.h" 11 #include "ppapi/thunk/thunk.h"
12 12
13 namespace ppapi { 13 namespace ppapi {
14 namespace thunk { 14 namespace thunk {
15 15
16 namespace { 16 namespace {
17 17
18 void Create(PP_Instance instance, 18 void Create(PP_Instance instance,
19 PP_Var name, 19 PP_Var name,
20 PP_Ext_Alarms_AlarmCreateInfo_Dev alarm_info) { 20 PP_Ext_Alarms_AlarmCreateInfo_Dev alarm_info) {
21 EnterInstanceAPI<ExtensionsCommon_API> enter(instance); 21 EnterInstanceAPI<ExtensionsCommon_API> enter(instance);
22 if (enter.failed()) 22 if (enter.failed())
23 return; 23 return;
24 24
25 std::vector<PP_Var> args; 25 std::vector<PP_Var> args;
26 args.push_back(name); 26 args.push_back(name);
27 args.push_back(alarm_info); 27 args.push_back(alarm_info);
28 enter.functions()->Post("alarms.create", args); 28 enter.functions()->PostRenderer("alarms.create", args);
29 } 29 }
30 30
31 int32_t Get(PP_Instance instance, 31 int32_t Get(PP_Instance instance,
32 PP_Var name, 32 PP_Var name,
33 PP_Ext_Alarms_Alarm_Dev* alarm, 33 PP_Ext_Alarms_Alarm_Dev* alarm,
34 PP_CompletionCallback callback) { 34 PP_CompletionCallback callback) {
35 EnterInstanceAPI<ExtensionsCommon_API> enter(instance, callback); 35 EnterInstanceAPI<ExtensionsCommon_API> enter(instance, callback);
36 if (enter.failed()) 36 if (enter.failed())
37 return enter.retval(); 37 return enter.retval();
38 38
39 std::vector<PP_Var> input_args; 39 std::vector<PP_Var> input_args;
40 std::vector<PP_Var*> output_args; 40 std::vector<PP_Var*> output_args;
41 input_args.push_back(name); 41 input_args.push_back(name);
42 output_args.push_back(alarm); 42 output_args.push_back(alarm);
43 return enter.SetResult(enter.functions()->Call( 43 return enter.SetResult(enter.functions()->CallRenderer(
44 "alarms.get", input_args, output_args, enter.callback())); 44 "alarms.get", input_args, output_args, enter.callback()));
45 } 45 }
46 46
47 int32_t GetAll(PP_Instance instance, 47 int32_t GetAll(PP_Instance instance,
48 PP_Ext_Alarms_Alarm_Dev_Array* alarms, 48 PP_Ext_Alarms_Alarm_Dev_Array* alarms,
49 PP_CompletionCallback callback) { 49 PP_CompletionCallback callback) {
50 EnterInstanceAPI<ExtensionsCommon_API> enter(instance, callback); 50 EnterInstanceAPI<ExtensionsCommon_API> enter(instance, callback);
51 if (enter.failed()) 51 if (enter.failed())
52 return enter.retval(); 52 return enter.retval();
53 53
54 std::vector<PP_Var> input_args; 54 std::vector<PP_Var> input_args;
55 std::vector<PP_Var*> output_args; 55 std::vector<PP_Var*> output_args;
56 output_args.push_back(alarms); 56 output_args.push_back(alarms);
57 return enter.SetResult(enter.functions()->Call( 57 return enter.SetResult(enter.functions()->CallRenderer(
58 "alarms.getAll", input_args, output_args, enter.callback())); 58 "alarms.getAll", input_args, output_args, enter.callback()));
59 } 59 }
60 60
61 void Clear(PP_Instance instance, PP_Var name) { 61 void Clear(PP_Instance instance, PP_Var name) {
62 EnterInstanceAPI<ExtensionsCommon_API> enter(instance); 62 EnterInstanceAPI<ExtensionsCommon_API> enter(instance);
63 if (enter.failed()) 63 if (enter.failed())
64 return; 64 return;
65 65
66 std::vector<PP_Var> args; 66 std::vector<PP_Var> args;
67 args.push_back(name); 67 args.push_back(name);
68 enter.functions()->Post("alarms.clear", args); 68 enter.functions()->PostRenderer("alarms.clear", args);
69 } 69 }
70 70
71 void ClearAll(PP_Instance instance) { 71 void ClearAll(PP_Instance instance) {
72 EnterInstanceAPI<ExtensionsCommon_API> enter(instance); 72 EnterInstanceAPI<ExtensionsCommon_API> enter(instance);
73 if (enter.failed()) 73 if (enter.failed())
74 return; 74 return;
75 75
76 std::vector<PP_Var> args; 76 std::vector<PP_Var> args;
77 enter.functions()->Post("alarms.clearAll", args); 77 enter.functions()->PostRenderer("alarms.clearAll", args);
78 } 78 }
79 79
80 const PPB_Ext_Alarms_Dev_0_1 g_ppb_ext_alarms_dev_0_1_thunk = { 80 const PPB_Ext_Alarms_Dev_0_1 g_ppb_ext_alarms_dev_0_1_thunk = {
81 &Create, 81 &Create,
82 &Get, 82 &Get,
83 &GetAll, 83 &GetAll,
84 &Clear, 84 &Clear,
85 &ClearAll 85 &ClearAll
86 }; 86 };
87 87
88 } // namespace 88 } // namespace
89 89
90 const PPB_Ext_Alarms_Dev_0_1* GetPPB_Ext_Alarms_Dev_0_1_Thunk() { 90 const PPB_Ext_Alarms_Dev_0_1* GetPPB_Ext_Alarms_Dev_0_1_Thunk() {
91 return &g_ppb_ext_alarms_dev_0_1_thunk; 91 return &g_ppb_ext_alarms_dev_0_1_thunk;
92 } 92 }
93 93
94 } // namespace thunk 94 } // namespace thunk
95 } // namespace ppapi 95 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/thunk/extensions_common_api.h ('k') | ppapi/thunk/ppb_ext_socket_thunk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698