1 // Copyright (c) 2012 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.
7 #include "ppapi/cpp/instance.h"
8 #include "ppapi/cpp/module.h"
9 #include "ppapi/cpp/var.h"
11 class SimpleInstance
: public pp::Instance
{
13 explicit SimpleInstance(PP_Instance instance
) : pp::Instance(instance
) {
16 virtual void HandleMessage(const pp::Var
& var_message
) {
17 if (var_message
.is_string() && var_message
.AsString() == "ping") {
18 PostMessage(pp::Var("pong"));
21 PostMessage(pp::Var("failed"));
25 class SimpleModule
: public pp::Module
{
27 virtual pp::Instance
* CreateInstance(PP_Instance instance
) {
28 return new SimpleInstance(instance
);
34 Module
* CreateModule() {
35 return new SimpleModule();