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
3// found in the LICENSE file.
4
5#include "ppapi/cpp/extensions/dev/events_dev.h"
6
7#include "ppapi/c/extensions/dev/ppb_ext_events_dev.h"
8#include "ppapi/cpp/module_impl.h"
9
10namespace pp {
11
12namespace {
13
14template <> const char* interface_name<PPB_Ext_Events_Dev_0_1>() {
15  return PPB_EXT_EVENTS_DEV_INTERFACE_0_1;
16}
17
18}  // namespace
19
20namespace ext {
21namespace events {
22
23// static
24uint32_t Events_Dev::AddListener(PP_Instance instance,
25                                 const PP_Ext_EventListener& listener) {
26  if (!has_interface<PPB_Ext_Events_Dev_0_1>())
27    return 0;
28  return get_interface<PPB_Ext_Events_Dev_0_1>()->AddListener(instance,
29                                                              listener);
30}
31
32// static
33void Events_Dev::RemoveListener(PP_Instance instance,
34                                uint32_t listener_id) {
35  if (has_interface<PPB_Ext_Events_Dev_0_1>()) {
36    get_interface<PPB_Ext_Events_Dev_0_1>()->RemoveListener(instance,
37                                                            listener_id);
38  }
39}
40
41}  // namespace events
42}  // namespace ext
43}  // namespace pp
44