blob: 6ed893573ec75f8aefb87ea7393db1e4713ee234 [file] [log] [blame]
[email protected]502ec4dd2012-06-11 20:45:011// 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
11namespace pp {
12
13namespace {
14
15template <> const char* interface_name<PPB_Flash_DeviceID_1_0>() {
16 return PPB_FLASH_DEVICEID_INTERFACE_1_0;
17}
18
19} // namespace
20
21namespace flash {
22
23DeviceID::DeviceID() {
24}
25
26DeviceID::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
33int32_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