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.
4
5#include "ppapi/shared_impl/ppb_device_ref_shared.h"
6
7#include "ppapi/shared_impl/host_resource.h"
8#include "ppapi/shared_impl/ppapi_globals.h"
9#include "ppapi/shared_impl/resource_tracker.h"
10#include "ppapi/shared_impl/var.h"
11
12using ppapi::thunk::PPB_DeviceRef_API;
13
14namespace ppapi {
15
16DeviceRefData::DeviceRefData() : type(PP_DEVICETYPE_DEV_INVALID) {}
17
18PPB_DeviceRef_Shared::PPB_DeviceRef_Shared(ResourceObjectType type,
19                                           PP_Instance instance,
20                                           const DeviceRefData& data)
21    : Resource(type, instance), data_(data) {}
22
23PPB_DeviceRef_API* PPB_DeviceRef_Shared::AsPPB_DeviceRef_API() { return this; }
24
25const DeviceRefData& PPB_DeviceRef_Shared::GetDeviceRefData() const {
26  return data_;
27}
28
29PP_DeviceType_Dev PPB_DeviceRef_Shared::GetType() { return data_.type; }
30
31PP_Var PPB_DeviceRef_Shared::GetName() {
32  return StringVar::StringToPPVar(data_.name);
33}
34
35}  // namespace ppapi
36