Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / ppapi / cpp / dev / device_ref_dev.cc
blob525739e16fc372dca877968c8e5d3f95f0757444
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.
5 #include "ppapi/cpp/dev/device_ref_dev.h"
7 #include "ppapi/cpp/module_impl.h"
9 namespace pp {
11 namespace {
13 template <> const char* interface_name<PPB_DeviceRef_Dev>() {
14 return PPB_DEVICEREF_DEV_INTERFACE;
17 } // namespace
19 DeviceRef_Dev::DeviceRef_Dev() {
22 DeviceRef_Dev::DeviceRef_Dev(PP_Resource resource) : Resource(resource) {
25 DeviceRef_Dev::DeviceRef_Dev(PassRef, PP_Resource resource)
26 : Resource(PASS_REF, resource) {
29 DeviceRef_Dev::DeviceRef_Dev(const DeviceRef_Dev& other) : Resource(other) {
32 DeviceRef_Dev::~DeviceRef_Dev() {
35 PP_DeviceType_Dev DeviceRef_Dev::GetType() const {
36 if (!has_interface<PPB_DeviceRef_Dev>())
37 return PP_DEVICETYPE_DEV_INVALID;
38 return get_interface<PPB_DeviceRef_Dev>()->GetType(pp_resource());
41 Var DeviceRef_Dev::GetName() const {
42 if (!has_interface<PPB_DeviceRef_Dev>())
43 return Var();
44 return Var(PASS_REF,
45 get_interface<PPB_DeviceRef_Dev>()->GetName(pp_resource()));
48 } // namespace pp