OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef PPAPI_SHARED_IMPL_PPB_NETWORK_LIST_PRIVATE_SHARED_H_ | 5 #ifndef PPAPI_SHARED_IMPL_PPB_NETWORK_LIST_PRIVATE_SHARED_H_ |
6 #define PPAPI_SHARED_IMPL_PPB_NETWORK_LIST_PRIVATE_SHARED_H_ | 6 #define PPAPI_SHARED_IMPL_PPB_NETWORK_LIST_PRIVATE_SHARED_H_ |
7 | 7 |
| 8 #include <string> |
8 #include <vector> | 9 #include <vector> |
9 | 10 |
10 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/ref_counted.h" |
12 #include "ppapi/shared_impl/resource.h" | 13 #include "ppapi/shared_impl/resource.h" |
13 #include "ppapi/thunk/ppb_network_list_private_api.h" | 14 #include "ppapi/thunk/ppb_network_list_private_api.h" |
14 | 15 |
15 namespace ppapi { | 16 namespace ppapi { |
16 | 17 |
17 struct PPAPI_SHARED_EXPORT NetworkInfo { | 18 struct PPAPI_SHARED_EXPORT NetworkInfo { |
18 NetworkInfo(); | 19 NetworkInfo(); |
19 ~NetworkInfo(); | 20 ~NetworkInfo(); |
20 | 21 |
21 std::string name; | 22 std::string name; |
22 PP_NetworkListType_Private type; | 23 PP_NetworkListType_Private type; |
23 PP_NetworkListState_Private state; | 24 PP_NetworkListState_Private state; |
24 std::vector<PP_NetAddress_Private> addresses; | 25 std::vector<PP_NetAddress_Private> addresses; |
25 std::string display_name; | 26 std::string display_name; |
26 int mtu; | 27 int mtu; |
27 }; | 28 }; |
28 typedef std::vector<NetworkInfo> NetworkList; | 29 typedef std::vector<NetworkInfo> NetworkList; |
29 | 30 |
30 // NetworkListStorage is refcounted container for NetworkList. It | 31 // NetworkListStorage is refcounted container for NetworkList. It |
31 // allows sharing of one NetworkList object between multiple | 32 // allows sharing of one NetworkList object between multiple |
32 // NetworkList resources. | 33 // NetworkList resources. |
33 class PPAPI_SHARED_EXPORT NetworkListStorage | 34 class PPAPI_SHARED_EXPORT NetworkListStorage |
34 : public base::RefCountedThreadSafe<NetworkListStorage> { | 35 : public base::RefCountedThreadSafe<NetworkListStorage> { |
35 public: | 36 public: |
36 NetworkListStorage(const NetworkList& list); | 37 explicit NetworkListStorage(const NetworkList& list); |
37 | 38 |
38 const NetworkList& list() { return list_; } | 39 const NetworkList& list() { return list_; } |
39 | 40 |
40 private: | 41 private: |
41 friend class base::RefCountedThreadSafe<NetworkListStorage>; | 42 friend class base::RefCountedThreadSafe<NetworkListStorage>; |
42 ~NetworkListStorage(); | 43 ~NetworkListStorage(); |
43 | 44 |
44 NetworkList list_; | 45 NetworkList list_; |
45 | 46 |
46 DISALLOW_COPY_AND_ASSIGN(NetworkListStorage); | 47 DISALLOW_COPY_AND_ASSIGN(NetworkListStorage); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 const scoped_refptr<NetworkListStorage>& list); | 79 const scoped_refptr<NetworkListStorage>& list); |
79 | 80 |
80 scoped_refptr<NetworkListStorage> list_; | 81 scoped_refptr<NetworkListStorage> list_; |
81 | 82 |
82 DISALLOW_COPY_AND_ASSIGN(PPB_NetworkList_Private_Shared); | 83 DISALLOW_COPY_AND_ASSIGN(PPB_NetworkList_Private_Shared); |
83 }; | 84 }; |
84 | 85 |
85 } // namespace ppapi | 86 } // namespace ppapi |
86 | 87 |
87 #endif // PPAPI_SHARED_IMPL_PPB_NETWORK_LIST_PRIVATE_SHARED_H_ | 88 #endif // PPAPI_SHARED_IMPL_PPB_NETWORK_LIST_PRIVATE_SHARED_H_ |
OLD | NEW |