Save errno for logging before potentially overwriting it.
[chromium-blink-merge.git] / ppapi / shared_impl / ppb_device_ref_shared.h
blob9ea367ee05d336667dc1cdb6136974d1afd1cc73
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 #ifndef PPAPI_SHARED_IMPL_PPB_DEVICE_REF_SHARED_H_
6 #define PPAPI_SHARED_IMPL_PPB_DEVICE_REF_SHARED_H_
8 #include <string>
9 #include <vector>
11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h"
13 #include "ppapi/shared_impl/resource.h"
14 #include "ppapi/thunk/ppb_device_ref_api.h"
16 namespace ppapi {
18 // IF YOU ADD STUFF TO THIS CLASS
19 // ==============================
20 // Be sure to add it to the STRUCT_TRAITS at the top of ppapi_messages.h.
21 struct PPAPI_SHARED_EXPORT DeviceRefData {
22 DeviceRefData();
24 bool operator==(const DeviceRefData& other) const {
25 return type == other.type &&
26 name == other.name &&
27 id == other.id;
30 PP_DeviceType_Dev type;
31 std::string name;
32 std::string id;
35 class PPAPI_SHARED_EXPORT PPB_DeviceRef_Shared
36 : public Resource,
37 public thunk::PPB_DeviceRef_API {
38 public:
39 PPB_DeviceRef_Shared(ResourceObjectType type,
40 PP_Instance instance,
41 const DeviceRefData& data);
43 // Resource overrides.
44 virtual PPB_DeviceRef_API* AsPPB_DeviceRef_API() OVERRIDE;
46 // PPB_DeviceRef_API implementation.
47 virtual const DeviceRefData& GetDeviceRefData() const OVERRIDE;
48 virtual PP_DeviceType_Dev GetType() OVERRIDE;
49 virtual PP_Var GetName() OVERRIDE;
51 static PP_Resource CreateResourceArray(
52 ResourceObjectType type,
53 PP_Instance instance,
54 const std::vector<DeviceRefData>& devices);
56 private:
57 DeviceRefData data_;
59 DISALLOW_IMPLICIT_CONSTRUCTORS(PPB_DeviceRef_Shared);
62 } // namespace ppapi
64 #endif // PPAPI_SHARED_IMPL_PPB_DEVICE_REF_SHARED_H_