Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Side by Side Diff: ppapi/cpp/private/flash_drm.cc

Issue 68773004: Pepper: Add MonitorIsExternal function to PPB_Flash_DRM. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix TODO, interface ordering.x Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ppapi/cpp/private/flash_drm.h" 5 #include "ppapi/cpp/private/flash_drm.h"
6 6
7 #include "ppapi/c/pp_errors.h" 7 #include "ppapi/c/pp_errors.h"
8 #include "ppapi/c/private/ppb_flash_device_id.h" 8 #include "ppapi/c/private/ppb_flash_device_id.h"
9 #include "ppapi/c/private/ppb_flash_drm.h" 9 #include "ppapi/c/private/ppb_flash_drm.h"
10 #include "ppapi/cpp/module_impl.h" 10 #include "ppapi/cpp/module_impl.h"
11 11
12 namespace pp { 12 namespace pp {
13 13
14 namespace { 14 namespace {
15 15
16 template <> const char* interface_name<PPB_Flash_DRM_1_0>() { 16 template <> const char* interface_name<PPB_Flash_DRM_1_0>() {
17 return PPB_FLASH_DRM_INTERFACE_1_0; 17 return PPB_FLASH_DRM_INTERFACE_1_0;
18 } 18 }
19 19
20 template <> const char* interface_name<PPB_Flash_DRM_1_1>() {
21 return PPB_FLASH_DRM_INTERFACE_1_1;
22 }
23
20 template <> const char* interface_name<PPB_Flash_DeviceID_1_0>() { 24 template <> const char* interface_name<PPB_Flash_DeviceID_1_0>() {
21 return PPB_FLASH_DEVICEID_INTERFACE_1_0; 25 return PPB_FLASH_DEVICEID_INTERFACE_1_0;
22 } 26 }
23 27
24 } // namespace 28 } // namespace
25 29
26 namespace flash { 30 namespace flash {
27 31
28 DRM::DRM() { 32 DRM::DRM() {
29 } 33 }
30 34
31 DRM::DRM(const InstanceHandle& instance) : Resource() { 35 DRM::DRM(const InstanceHandle& instance) : Resource() {
32 if (has_interface<PPB_Flash_DRM_1_0>()) { 36 if (has_interface<PPB_Flash_DRM_1_1>()) {
37 PassRefFromConstructor(get_interface<PPB_Flash_DRM_1_1>()->Create(
38 instance.pp_instance()));
39 } else if (has_interface<PPB_Flash_DRM_1_0>()) {
33 PassRefFromConstructor(get_interface<PPB_Flash_DRM_1_0>()->Create( 40 PassRefFromConstructor(get_interface<PPB_Flash_DRM_1_0>()->Create(
34 instance.pp_instance())); 41 instance.pp_instance()));
35 } else if (has_interface<PPB_Flash_DeviceID_1_0>()) { 42 } else if (has_interface<PPB_Flash_DeviceID_1_0>()) {
36 PassRefFromConstructor(get_interface<PPB_Flash_DeviceID_1_0>()->Create( 43 PassRefFromConstructor(get_interface<PPB_Flash_DeviceID_1_0>()->Create(
37 instance.pp_instance())); 44 instance.pp_instance()));
38 } 45 }
39 } 46 }
40 47
41 int32_t DRM::GetDeviceID(const CompletionCallbackWithOutput<Var>& callback) { 48 int32_t DRM::GetDeviceID(const CompletionCallbackWithOutput<Var>& callback) {
49 if (has_interface<PPB_Flash_DRM_1_1>()) {
50 return get_interface<PPB_Flash_DRM_1_1>()->GetDeviceID(
51 pp_resource(),
52 callback.output(),
53 callback.pp_completion_callback());
54 }
42 if (has_interface<PPB_Flash_DRM_1_0>()) { 55 if (has_interface<PPB_Flash_DRM_1_0>()) {
43 return get_interface<PPB_Flash_DRM_1_0>()->GetDeviceID( 56 return get_interface<PPB_Flash_DRM_1_0>()->GetDeviceID(
44 pp_resource(), 57 pp_resource(),
45 callback.output(), 58 callback.output(),
46 callback.pp_completion_callback()); 59 callback.pp_completion_callback());
47 } 60 }
48 if (has_interface<PPB_Flash_DeviceID_1_0>()) { 61 if (has_interface<PPB_Flash_DeviceID_1_0>()) {
49 return get_interface<PPB_Flash_DeviceID_1_0>()->GetDeviceID( 62 return get_interface<PPB_Flash_DeviceID_1_0>()->GetDeviceID(
50 pp_resource(), 63 pp_resource(),
51 callback.output(), 64 callback.output(),
52 callback.pp_completion_callback()); 65 callback.pp_completion_callback());
53 } 66 }
54 return callback.MayForce(PP_ERROR_NOINTERFACE); 67 return callback.MayForce(PP_ERROR_NOINTERFACE);
55 } 68 }
56 69
57 bool DRM::GetHmonitor(int64_t* hmonitor) { 70 bool DRM::GetHmonitor(int64_t* hmonitor) {
71 if (has_interface<PPB_Flash_DRM_1_1>()) {
72 return PP_ToBool(get_interface<PPB_Flash_DRM_1_1>()->GetHmonitor(
73 pp_resource(),
74 hmonitor));
75 }
58 if (has_interface<PPB_Flash_DRM_1_0>()) { 76 if (has_interface<PPB_Flash_DRM_1_0>()) {
59 return PP_ToBool(get_interface<PPB_Flash_DRM_1_0>()->GetHmonitor( 77 return PP_ToBool(get_interface<PPB_Flash_DRM_1_0>()->GetHmonitor(
60 pp_resource(), 78 pp_resource(),
61 hmonitor)); 79 hmonitor));
62 } 80 }
63 return 0; 81 return 0;
64 } 82 }
65 83
66 int32_t DRM::GetVoucherFile( 84 int32_t DRM::GetVoucherFile(
67 const CompletionCallbackWithOutput<FileRef>& callback) { 85 const CompletionCallbackWithOutput<FileRef>& callback) {
86 if (has_interface<PPB_Flash_DRM_1_1>()) {
87 return get_interface<PPB_Flash_DRM_1_1>()->GetVoucherFile(
88 pp_resource(),
89 callback.output(),
90 callback.pp_completion_callback());
91 }
68 if (has_interface<PPB_Flash_DRM_1_0>()) { 92 if (has_interface<PPB_Flash_DRM_1_0>()) {
69 return get_interface<PPB_Flash_DRM_1_0>()->GetVoucherFile( 93 return get_interface<PPB_Flash_DRM_1_0>()->GetVoucherFile(
70 pp_resource(), 94 pp_resource(),
71 callback.output(), 95 callback.output(),
72 callback.pp_completion_callback()); 96 callback.pp_completion_callback());
73 } 97 }
74 return PP_ERROR_NOINTERFACE; 98 return PP_ERROR_NOINTERFACE;
75 } 99 }
76 100
101 int32_t DRM::MonitorIsExternal(
102 const CompletionCallbackWithOutput<PP_Bool>& callback) {
103 if (has_interface<PPB_Flash_DRM_1_1>()) {
104 return get_interface<PPB_Flash_DRM_1_1>()->MonitorIsExternal(
105 pp_resource(),
106 callback.output(),
107 callback.pp_completion_callback());
108 }
109 return PP_ERROR_NOINTERFACE;
110 }
111
77 } // namespace flash 112 } // namespace flash
78 } // namespace pp 113 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/cpp/private/flash_drm.h ('k') | ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698