OLD | NEW |
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_device_id.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/cpp/module_impl.h" | 10 #include "ppapi/cpp/module_impl.h" |
10 | 11 |
11 namespace pp { | 12 namespace pp { |
12 | 13 |
13 namespace { | 14 namespace { |
14 | 15 |
| 16 template <> const char* interface_name<PPB_Flash_DRM_1_0>() { |
| 17 return PPB_FLASH_DRM_INTERFACE_1_0; |
| 18 } |
| 19 |
15 template <> const char* interface_name<PPB_Flash_DeviceID_1_0>() { | 20 template <> const char* interface_name<PPB_Flash_DeviceID_1_0>() { |
16 return PPB_FLASH_DEVICEID_INTERFACE_1_0; | 21 return PPB_FLASH_DEVICEID_INTERFACE_1_0; |
17 } | 22 } |
18 | 23 |
19 } // namespace | 24 } // namespace |
20 | 25 |
21 namespace flash { | 26 namespace flash { |
22 | 27 |
23 DeviceID::DeviceID() { | 28 DRM::DRM() { |
24 } | 29 } |
25 | 30 |
26 DeviceID::DeviceID(const InstanceHandle& instance) : Resource() { | 31 DRM::DRM(const InstanceHandle& instance) : Resource() { |
27 if (has_interface<PPB_Flash_DeviceID_1_0>()) { | 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>()) { |
28 PassRefFromConstructor(get_interface<PPB_Flash_DeviceID_1_0>()->Create( | 36 PassRefFromConstructor(get_interface<PPB_Flash_DeviceID_1_0>()->Create( |
29 instance.pp_instance())); | 37 instance.pp_instance())); |
30 } | 38 } |
31 } | 39 } |
32 | 40 |
33 int32_t DeviceID::GetDeviceID( | 41 int32_t DRM::GetDeviceID(const CompletionCallbackWithOutput<Var>& callback) { |
34 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()); |
| 47 } |
35 if (has_interface<PPB_Flash_DeviceID_1_0>()) { | 48 if (has_interface<PPB_Flash_DeviceID_1_0>()) { |
36 return get_interface<PPB_Flash_DeviceID_1_0>()->GetDeviceID( | 49 return get_interface<PPB_Flash_DeviceID_1_0>()->GetDeviceID( |
37 pp_resource(), | 50 pp_resource(), |
38 callback.output(), | 51 callback.output(), |
39 callback.pp_completion_callback()); | 52 callback.pp_completion_callback()); |
40 } | 53 } |
41 return callback.MayForce(PP_ERROR_NOINTERFACE); | 54 return callback.MayForce(PP_ERROR_NOINTERFACE); |
42 } | 55 } |
43 | 56 |
44 } // namespace flash | 57 } // namespace flash |
45 } // namespace pp | 58 } // namespace pp |
OLD | NEW |