1// Copyright 2014 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/private/input_event_private.h"
6
7#include "ppapi/cpp/module_impl.h"
8
9namespace pp {
10
11namespace {
12
13template <> const char* interface_name<PPB_InputEvent_Private>() {
14  return PPB_INPUTEVENT_PRIVATE_INTERFACE;
15}
16
17}  // namespace
18
19InputEventPrivate::InputEventPrivate() : InputEvent() {
20}
21
22InputEventPrivate::InputEventPrivate(const InputEvent& event) : InputEvent() {
23  if (!has_interface<PPB_InputEvent_Private_0_1>())
24    return;
25  Module::Get()->core()->AddRefResource(event.pp_resource());
26  PassRefFromConstructor(event.pp_resource());
27}
28
29bool InputEventPrivate::TraceInputLatency(bool has_damage) {
30  if (!has_interface<PPB_InputEvent_Private_0_1>())
31    return false;
32  return PP_ToBool(
33      get_interface<PPB_InputEvent_Private_0_1>()->TraceInputLatency(
34          pp_resource(), PP_FromBool(has_damage)));
35}
36
37void InputEventPrivate::StartTrackingLatency(const InstanceHandle& instance) {
38  if (!has_interface<PPB_InputEvent_Private>())
39    return;
40  return get_interface<PPB_InputEvent_Private>()->StartTrackingLatency(
41      instance.pp_instance());
42}
43
44}  // namespace pp
45