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

Side by Side Diff: ppapi/cpp/dev/hello_dev.cc

Issue 8414054: Hello Pepper API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 9 years, 1 month 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/cpp/dev/hello_dev.h ('k') | ppapi/ppapi_cpp.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/cpp/dev/hello_dev.h"
6
7 #include <stdio.h>
8
9 #include "ppapi/c/dev/ppb_hello_dev.h"
10 #include "ppapi/c/pp_errors.h"
11 #include "ppapi/cpp/module.h"
12 #include "ppapi/cpp/module_impl.h"
13
14 namespace pp {
15
16 namespace {
17
18 template <> const char* interface_name<PPB_Hello_Dev>() {
19 return PPB_HELLO_DEV_INTERFACE;
20 }
21
22 } // namespace
23
24 Hello::Hello(Instance* instance) {
25 puts("C++ API Hello (constructor)");
26 if (!has_interface<PPB_Hello_Dev>()) {
27 puts(" has_interface<PPB_Hello_Dev> return false");
28 return;
29 }
30 PassRefFromConstructor(get_interface<PPB_Hello_Dev>()->Create(
31 instance->pp_instance()));
32 }
33
34 int32_t Hello::SayHello() {
35 puts("C++ API SayHello");
36 if (!has_interface<PPB_Hello_Dev>()) {
37 puts(" has_interface<PPB_Hello_Dev> return false");
38 return PP_ERROR_NOINTERFACE;
39 }
40 return get_interface<PPB_Hello_Dev>()->SayHello(pp_resource());
41 }
42
43 void Hello::WhoAreYou(char *name, uint32_t size,
44 CompletionCallback callback) {
45 puts("C++ API WhoAreYou");
46 if (!has_interface<PPB_Hello_Dev>()) {
47 puts("has_interface<PPB_Hello_Dev>() return false");
48 return;
49 }
50 get_interface<PPB_Hello_Dev>()->WhoAreYou(pp_resource(), name, size,
51 callback.pp_completion_callback());
52 }
53
54 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/cpp/dev/hello_dev.h ('k') | ppapi/ppapi_cpp.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698