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_PROXY_INTERFACE_LIST_H_ | 5 #ifndef PPAPI_PROXY_INTERFACE_LIST_H_ |
6 #define PPAPI_PROXY_INTERFACE_LIST_H_ | 6 #define PPAPI_PROXY_INTERFACE_LIST_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
| 9 #include <memory> |
9 #include <string> | 10 #include <string> |
10 | 11 |
11 #include "base/containers/scoped_ptr_hash_map.h" | 12 #include "base/containers/scoped_ptr_hash_map.h" |
12 #include "base/macros.h" | 13 #include "base/macros.h" |
13 #include "base/memory/scoped_ptr.h" | |
14 #include "base/synchronization/lock.h" | 14 #include "base/synchronization/lock.h" |
15 #include "ppapi/proxy/interface_proxy.h" | 15 #include "ppapi/proxy/interface_proxy.h" |
16 #include "ppapi/proxy/ppapi_proxy_export.h" | 16 #include "ppapi/proxy/ppapi_proxy_export.h" |
17 #include "ppapi/shared_impl/ppapi_permissions.h" | 17 #include "ppapi/shared_impl/ppapi_permissions.h" |
18 | 18 |
19 namespace ppapi { | 19 namespace ppapi { |
20 namespace proxy { | 20 namespace proxy { |
21 | 21 |
22 class PPAPI_PROXY_EXPORT InterfaceList { | 22 class PPAPI_PROXY_EXPORT InterfaceList { |
23 public: | 23 public: |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 | 74 |
75 const void* const iface_; | 75 const void* const iface_; |
76 const Permission required_permission_; | 76 const Permission required_permission_; |
77 | 77 |
78 bool sent_to_uma_; | 78 bool sent_to_uma_; |
79 base::Lock sent_to_uma_lock_; | 79 base::Lock sent_to_uma_lock_; |
80 }; | 80 }; |
81 // Give friendship for HashInterfaceName. | 81 // Give friendship for HashInterfaceName. |
82 friend class InterfaceInfo; | 82 friend class InterfaceInfo; |
83 | 83 |
84 typedef base::ScopedPtrHashMap<std::string, scoped_ptr<InterfaceInfo>> | 84 typedef base::ScopedPtrHashMap<std::string, std::unique_ptr<InterfaceInfo>> |
85 NameToInterfaceInfoMap; | 85 NameToInterfaceInfoMap; |
86 | 86 |
87 void AddProxy(ApiID id, InterfaceProxy::Factory factory); | 87 void AddProxy(ApiID id, InterfaceProxy::Factory factory); |
88 | 88 |
89 // Permissions is the type of permission required to access the corresponding | 89 // Permissions is the type of permission required to access the corresponding |
90 // interface. Currently this must be just one unique permission (rather than | 90 // interface. Currently this must be just one unique permission (rather than |
91 // a bitfield). | 91 // a bitfield). |
92 void AddPPB(const char* name, const void* iface, Permission permission); | 92 void AddPPB(const char* name, const void* iface, Permission permission); |
93 void AddPPP(const char* name, const void* iface); | 93 void AddPPP(const char* name, const void* iface); |
94 | 94 |
95 // Hash the interface name for UMA logging. | 95 // Hash the interface name for UMA logging. |
96 static int HashInterfaceName(const std::string& name); | 96 static int HashInterfaceName(const std::string& name); |
97 | 97 |
98 PpapiPermissions permissions_; | 98 PpapiPermissions permissions_; |
99 | 99 |
100 NameToInterfaceInfoMap name_to_browser_info_; | 100 NameToInterfaceInfoMap name_to_browser_info_; |
101 NameToInterfaceInfoMap name_to_plugin_info_; | 101 NameToInterfaceInfoMap name_to_plugin_info_; |
102 | 102 |
103 InterfaceProxy::Factory id_to_factory_[API_ID_COUNT]; | 103 InterfaceProxy::Factory id_to_factory_[API_ID_COUNT]; |
104 | 104 |
105 DISALLOW_COPY_AND_ASSIGN(InterfaceList); | 105 DISALLOW_COPY_AND_ASSIGN(InterfaceList); |
106 }; | 106 }; |
107 | 107 |
108 } // namespace proxy | 108 } // namespace proxy |
109 } // namespace ppapi | 109 } // namespace ppapi |
110 | 110 |
111 #endif // PPAPI_PROXY_INTERFACE_LIST_H_ | 111 #endif // PPAPI_PROXY_INTERFACE_LIST_H_ |
112 | 112 |
OLD | NEW |