| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef EXTENSIONS_COMMON_PERMISSIONS_SOCKET_PERMISSION_DATA_H_ | 4 #ifndef EXTENSIONS_COMMON_PERMISSIONS_SOCKET_PERMISSION_DATA_H_ |
| 5 #define EXTENSIONS_COMMON_PERMISSIONS_SOCKET_PERMISSION_DATA_H_ | 5 #define EXTENSIONS_COMMON_PERMISSIONS_SOCKET_PERMISSION_DATA_H_ |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "extensions/common/permissions/api_permission.h" | 9 #include "extensions/common/permissions/api_permission.h" |
| 10 #include "extensions/common/permissions/socket_permission_entry.h" | 10 #include "extensions/common/permissions/socket_permission_entry.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 // operators <, == are needed by container std::set and algorithms | 48 // operators <, == are needed by container std::set and algorithms |
| 49 // std::set_includes and std::set_differences. | 49 // std::set_includes and std::set_differences. |
| 50 bool operator<(const SocketPermissionData& rhs) const; | 50 bool operator<(const SocketPermissionData& rhs) const; |
| 51 bool operator==(const SocketPermissionData& rhs) const; | 51 bool operator==(const SocketPermissionData& rhs) const; |
| 52 | 52 |
| 53 // Check if |param| (which must be a SocketPermissionData::CheckParam) | 53 // Check if |param| (which must be a SocketPermissionData::CheckParam) |
| 54 // matches the spec of |this|. | 54 // matches the spec of |this|. |
| 55 bool Check(const APIPermission::CheckParam* param) const; | 55 bool Check(const APIPermission::CheckParam* param) const; |
| 56 | 56 |
| 57 // Convert |this| into a base::Value. | 57 // Convert |this| into a base::Value. |
| 58 scoped_ptr<base::Value> ToValue() const; | 58 std::unique_ptr<base::Value> ToValue() const; |
| 59 | 59 |
| 60 // Populate |this| from a base::Value. | 60 // Populate |this| from a base::Value. |
| 61 bool FromValue(const base::Value* value); | 61 bool FromValue(const base::Value* value); |
| 62 | 62 |
| 63 // TODO(bryeung): SocketPermissionData should be encoded as a base::Value | 63 // TODO(bryeung): SocketPermissionData should be encoded as a base::Value |
| 64 // instead of a string. Until that is done, expose these methods for | 64 // instead of a string. Until that is done, expose these methods for |
| 65 // testing. | 65 // testing. |
| 66 bool ParseForTest(const std::string& permission) { return Parse(permission); } | 66 bool ParseForTest(const std::string& permission) { return Parse(permission); } |
| 67 const std::string& GetAsStringForTest() const { return GetAsString(); } | 67 const std::string& GetAsStringForTest() const { return GetAsString(); } |
| 68 | 68 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 80 const std::string& GetAsString() const; | 80 const std::string& GetAsString() const; |
| 81 void Reset(); | 81 void Reset(); |
| 82 | 82 |
| 83 SocketPermissionEntry entry_; | 83 SocketPermissionEntry entry_; |
| 84 mutable std::string spec_; | 84 mutable std::string spec_; |
| 85 }; | 85 }; |
| 86 | 86 |
| 87 } // namespace extensions | 87 } // namespace extensions |
| 88 | 88 |
| 89 #endif // EXTENSIONS_COMMON_PERMISSIONS_SOCKET_PERMISSION_DATA_H_ | 89 #endif // EXTENSIONS_COMMON_PERMISSIONS_SOCKET_PERMISSION_DATA_H_ |
| OLD | NEW |