ppb_device_ref_shared.h revision 5d1f7b1de12d16ceb2c938c56701a3e8bfa558f7
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#ifndef PPAPI_SHARED_IMPL_PPB_DEVICE_REF_SHARED_H_
6#define PPAPI_SHARED_IMPL_PPB_DEVICE_REF_SHARED_H_
7
8#include <string>
9
10#include "base/basictypes.h"
11#include "base/compiler_specific.h"
12#include "ppapi/shared_impl/resource.h"
13#include "ppapi/thunk/ppb_device_ref_api.h"
14
15namespace ppapi {
16
17// IF YOU ADD STUFF TO THIS CLASS
18// ==============================
19// Be sure to add it to the STRUCT_TRAITS at the top of ppapi_messages.h.
20struct PPAPI_SHARED_EXPORT DeviceRefData {
21  DeviceRefData();
22
23  bool operator==(const DeviceRefData& other) const {
24    return type == other.type &&
25           name == other.name &&
26           id == other.id;
27  }
28
29  PP_DeviceType_Dev type;
30  std::string name;
31  std::string id;
32};
33
34class PPAPI_SHARED_EXPORT PPB_DeviceRef_Shared
35    : public Resource,
36      public thunk::PPB_DeviceRef_API {
37 public:
38  PPB_DeviceRef_Shared(ResourceObjectType type,
39                       PP_Instance instance,
40                       const DeviceRefData& data);
41
42  // Resource overrides.
43  virtual PPB_DeviceRef_API* AsPPB_DeviceRef_API() OVERRIDE;
44
45  // PPB_DeviceRef_API implementation.
46  virtual const DeviceRefData& GetDeviceRefData() const OVERRIDE;
47  virtual PP_DeviceType_Dev GetType() OVERRIDE;
48  virtual PP_Var GetName() OVERRIDE;
49
50 private:
51  DeviceRefData data_;
52
53  DISALLOW_IMPLICIT_CONSTRUCTORS(PPB_DeviceRef_Shared);
54};
55
56}  // namespace ppapi
57
58#endif  // PPAPI_SHARED_IMPL_PPB_DEVICE_REF_SHARED_H_
59