Home | History | Annotate | Download | only in private
      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.
      4 
      5 #include "ppapi/cpp/private/flash_device_id.h"
      6 
      7 #include "ppapi/c/pp_errors.h"
      8 #include "ppapi/c/private/ppb_flash_device_id.h"
      9 #include "ppapi/cpp/module_impl.h"
     10 
     11 namespace pp {
     12 
     13 namespace {
     14 
     15 template <> const char* interface_name<PPB_Flash_DeviceID_1_0>() {
     16   return PPB_FLASH_DEVICEID_INTERFACE_1_0;
     17 }
     18 
     19 }  // namespace
     20 
     21 namespace flash {
     22 
     23 DeviceID::DeviceID() {
     24 }
     25 
     26 DeviceID::DeviceID(const InstanceHandle& instance) : Resource() {
     27   if (has_interface<PPB_Flash_DeviceID_1_0>()) {
     28     PassRefFromConstructor(get_interface<PPB_Flash_DeviceID_1_0>()->Create(
     29         instance.pp_instance()));
     30   }
     31 }
     32 
     33 int32_t DeviceID::GetDeviceID(
     34     const CompletionCallbackWithOutput<Var>& callback) {
     35   if (has_interface<PPB_Flash_DeviceID_1_0>()) {
     36     return get_interface<PPB_Flash_DeviceID_1_0>()->GetDeviceID(
     37         pp_resource(),
     38         callback.output(),
     39         callback.pp_completion_callback());
     40   }
     41   return callback.MayForce(PP_ERROR_NOINTERFACE);
     42 }
     43 
     44 }  // namespace flash
     45 }  // namespace pp
     46