Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / ppapi / cpp / private / flash_device_id.cc
blob6ed893573ec75f8aefb87ea7393db1e4713ee234
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.
5 #include "ppapi/cpp/private/flash_device_id.h"
7 #include "ppapi/c/pp_errors.h"
8 #include "ppapi/c/private/ppb_flash_device_id.h"
9 #include "ppapi/cpp/module_impl.h"
11 namespace pp {
13 namespace {
15 template <> const char* interface_name<PPB_Flash_DeviceID_1_0>() {
16 return PPB_FLASH_DEVICEID_INTERFACE_1_0;
19 } // namespace
21 namespace flash {
23 DeviceID::DeviceID() {
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()));
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());
41 return callback.MayForce(PP_ERROR_NOINTERFACE);
44 } // namespace flash
45 } // namespace pp