Chromium Code Reviews| 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>()) { |
| 35 if (has_interface<PPB_Flash_DeviceID_1_0>()) { | 43 return get_interface<PPB_Flash_DRM_1_0>()->GetDeviceID( |
| 44 pp_resource(), | |
| 45 callback.output(), | |
| 46 callback.pp_completion_callback()); | |
| 47 } else if (has_interface<PPB_Flash_DeviceID_1_0>()) { | |
|
yzshen1
2013/05/21 06:32:31
The way that our style guide prefers: remove the '
raymes
2013/05/21 16:32:51
Done.
| |
| 36 return get_interface<PPB_Flash_DeviceID_1_0>()->GetDeviceID( | 48 return get_interface<PPB_Flash_DeviceID_1_0>()->GetDeviceID( |
| 37 pp_resource(), | 49 pp_resource(), |
| 38 callback.output(), | 50 callback.output(), |
| 39 callback.pp_completion_callback()); | 51 callback.pp_completion_callback()); |
| 40 } | 52 } |
| 41 return callback.MayForce(PP_ERROR_NOINTERFACE); | 53 return callback.MayForce(PP_ERROR_NOINTERFACE); |
| 42 } | 54 } |
| 43 | 55 |
| 44 } // namespace flash | 56 } // namespace flash |
| 45 } // namespace pp | 57 } // namespace pp |
| OLD | NEW |