Add ability to change display settings to chrome.systemInfo.display
[chromium-blink-merge.git] / ppapi / shared_impl / ppb_network_list_private_shared.h
blob916cc129d7a1c96379a36f2d1bfd7c169c24ca28
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_NETWORK_LIST_PRIVATE_SHARED_H_
6 #define PPAPI_SHARED_IMPL_PPB_NETWORK_LIST_PRIVATE_SHARED_H_
8 #include <string>
9 #include <vector>
11 #include "base/basictypes.h"
12 #include "base/memory/ref_counted.h"
13 #include "ppapi/shared_impl/resource.h"
14 #include "ppapi/thunk/ppb_network_list_api.h"
16 namespace ppapi {
18 struct PPAPI_SHARED_EXPORT NetworkInfo {
19 NetworkInfo();
20 ~NetworkInfo();
22 std::string name;
23 PP_NetworkListType_Private type;
24 PP_NetworkListState_Private state;
25 std::vector<PP_NetAddress_Private> addresses;
26 std::string display_name;
27 int mtu;
29 typedef std::vector<NetworkInfo> NetworkList;
31 // NetworkListStorage is refcounted container for NetworkList. It
32 // allows sharing of one NetworkList object between multiple
33 // NetworkList resources.
34 class PPAPI_SHARED_EXPORT NetworkListStorage
35 : public base::RefCountedThreadSafe<NetworkListStorage> {
36 public:
37 explicit NetworkListStorage(const NetworkList& list);
39 const NetworkList& list() { return list_; }
41 private:
42 friend class base::RefCountedThreadSafe<NetworkListStorage>;
43 ~NetworkListStorage();
45 NetworkList list_;
47 DISALLOW_COPY_AND_ASSIGN(NetworkListStorage);
50 class PPAPI_SHARED_EXPORT PPB_NetworkList_Private_Shared
51 : public ::ppapi::Resource,
52 public ::ppapi::thunk::PPB_NetworkList_API {
53 public:
54 static PP_Resource Create(ResourceObjectType type,
55 PP_Instance instance,
56 const scoped_refptr<NetworkListStorage>& list);
58 virtual ~PPB_NetworkList_Private_Shared();
60 // Resource override.
61 virtual ::ppapi::thunk::PPB_NetworkList_API*
62 AsPPB_NetworkList_API() OVERRIDE;
64 // PPB_NetworkList_API implementation.
65 virtual const NetworkList& GetNetworkListData() const OVERRIDE;
66 virtual uint32_t GetCount() OVERRIDE;
67 virtual PP_Var GetName(uint32_t index) OVERRIDE;
68 virtual PP_NetworkListType_Private GetType(uint32_t index) OVERRIDE;
69 virtual PP_NetworkListState_Private GetState(uint32_t index) OVERRIDE;
70 virtual int32_t GetIpAddresses(uint32_t index,
71 PP_NetAddress_Private addresses[],
72 uint32_t count) OVERRIDE;
73 virtual PP_Var GetDisplayName(uint32_t index) OVERRIDE;
74 virtual uint32_t GetMTU(uint32_t index) OVERRIDE;
76 private:
77 PPB_NetworkList_Private_Shared(ResourceObjectType type,
78 PP_Instance instance,
79 const scoped_refptr<NetworkListStorage>& list);
81 scoped_refptr<NetworkListStorage> list_;
83 DISALLOW_COPY_AND_ASSIGN(PPB_NetworkList_Private_Shared);
86 } // namespace ppapi
88 #endif // PPAPI_SHARED_IMPL_PPB_NETWORK_LIST_PRIVATE_SHARED_H_