cc: Added inline to Tile::IsReadyToDraw
[chromium-blink-merge.git] / ppapi / cpp / private / flash_drm.cc
blob44887abc207030dd460274cf86af9724e8451ab0
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/private/flash_drm.h"
7 #include "ppapi/c/pp_errors.h"
8 #include "ppapi/c/private/ppb_flash_device_id.h"
9 #include "ppapi/c/private/ppb_flash_drm.h"
10 #include "ppapi/cpp/module_impl.h"
12 namespace pp {
14 namespace {
16 template <> const char* interface_name<PPB_Flash_DRM_1_0>() {
17 return PPB_FLASH_DRM_INTERFACE_1_0;
20 template <> const char* interface_name<PPB_Flash_DeviceID_1_0>() {
21 return PPB_FLASH_DEVICEID_INTERFACE_1_0;
24 } // namespace
26 namespace flash {
28 DRM::DRM() {
31 DRM::DRM(const InstanceHandle& instance) : Resource() {
32 if (has_interface<PPB_Flash_DRM_1_0>()) {
33 PassRefFromConstructor(get_interface<PPB_Flash_DRM_1_0>()->Create(
34 instance.pp_instance()));
35 } else if (has_interface<PPB_Flash_DeviceID_1_0>()) {
36 PassRefFromConstructor(get_interface<PPB_Flash_DeviceID_1_0>()->Create(
37 instance.pp_instance()));
41 int32_t DRM::GetDeviceID(const CompletionCallbackWithOutput<Var>& callback) {
42 if (has_interface<PPB_Flash_DRM_1_0>()) {
43 return get_interface<PPB_Flash_DRM_1_0>()->GetDeviceID(
44 pp_resource(),
45 callback.output(),
46 callback.pp_completion_callback());
48 if (has_interface<PPB_Flash_DeviceID_1_0>()) {
49 return get_interface<PPB_Flash_DeviceID_1_0>()->GetDeviceID(
50 pp_resource(),
51 callback.output(),
52 callback.pp_completion_callback());
54 return callback.MayForce(PP_ERROR_NOINTERFACE);
57 bool DRM::GetHmonitor(int64_t* hmonitor) {
58 if (has_interface<PPB_Flash_DRM_1_0>()) {
59 return PP_ToBool(get_interface<PPB_Flash_DRM_1_0>()->GetHmonitor(
60 pp_resource(),
61 hmonitor));
63 return 0;
66 int32_t DRM::GetVoucherFile(
67 const CompletionCallbackWithOutput<FileRef>& callback) {
68 if (has_interface<PPB_Flash_DRM_1_0>()) {
69 return get_interface<PPB_Flash_DRM_1_0>()->GetVoucherFile(
70 pp_resource(),
71 callback.output(),
72 callback.pp_completion_callback());
74 return PP_ERROR_FAILED;
77 } // namespace flash
78 } // namespace pp