| 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 | 4 |
| 5 #ifndef EXTENSIONS_COMMON_API_SOCKETS_SOCKETS_MANIFEST_PERMISSION_H_ | 5 #ifndef EXTENSIONS_COMMON_API_SOCKETS_SOCKETS_MANIFEST_PERMISSION_H_ |
| 6 #define EXTENSIONS_COMMON_API_SOCKETS_SOCKETS_MANIFEST_PERMISSION_H_ | 6 #define EXTENSIONS_COMMON_API_SOCKETS_SOCKETS_MANIFEST_PERMISSION_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 typedef std::set<SocketPermissionEntry> SocketPermissionEntrySet; | 25 typedef std::set<SocketPermissionEntry> SocketPermissionEntrySet; |
| 26 | 26 |
| 27 class SocketsManifestPermission : public ManifestPermission { | 27 class SocketsManifestPermission : public ManifestPermission { |
| 28 public: | 28 public: |
| 29 SocketsManifestPermission(); | 29 SocketsManifestPermission(); |
| 30 ~SocketsManifestPermission() override; | 30 ~SocketsManifestPermission() override; |
| 31 | 31 |
| 32 // Tries to construct the info based on |value|, as it would have appeared in | 32 // Tries to construct the info based on |value|, as it would have appeared in |
| 33 // the manifest. Sets |error| and returns an empty scoped_ptr on failure. | 33 // the manifest. Sets |error| and returns an empty scoped_ptr on failure. |
| 34 static scoped_ptr<SocketsManifestPermission> FromValue( | 34 static std::unique_ptr<SocketsManifestPermission> FromValue( |
| 35 const base::Value& value, | 35 const base::Value& value, |
| 36 base::string16* error); | 36 base::string16* error); |
| 37 | 37 |
| 38 bool CheckRequest(const Extension* extension, | 38 bool CheckRequest(const Extension* extension, |
| 39 const content::SocketPermissionRequest& request) const; | 39 const content::SocketPermissionRequest& request) const; |
| 40 | 40 |
| 41 void AddPermission(const SocketPermissionEntry& entry); | 41 void AddPermission(const SocketPermissionEntry& entry); |
| 42 | 42 |
| 43 // extensions::ManifestPermission overrides. | 43 // extensions::ManifestPermission overrides. |
| 44 std::string name() const override; | 44 std::string name() const override; |
| 45 std::string id() const override; | 45 std::string id() const override; |
| 46 PermissionIDSet GetPermissions() const override; | 46 PermissionIDSet GetPermissions() const override; |
| 47 bool FromValue(const base::Value* value) override; | 47 bool FromValue(const base::Value* value) override; |
| 48 scoped_ptr<base::Value> ToValue() const override; | 48 std::unique_ptr<base::Value> ToValue() const override; |
| 49 ManifestPermission* Diff(const ManifestPermission* rhs) const override; | 49 ManifestPermission* Diff(const ManifestPermission* rhs) const override; |
| 50 ManifestPermission* Union(const ManifestPermission* rhs) const override; | 50 ManifestPermission* Union(const ManifestPermission* rhs) const override; |
| 51 ManifestPermission* Intersect(const ManifestPermission* rhs) const override; | 51 ManifestPermission* Intersect(const ManifestPermission* rhs) const override; |
| 52 | 52 |
| 53 const SocketPermissionEntrySet& entries() const { return permissions_; } | 53 const SocketPermissionEntrySet& entries() const { return permissions_; } |
| 54 | 54 |
| 55 // Adds the permissions from |sockets| into the permission lists |ids| and | 55 // Adds the permissions from |sockets| into the permission lists |ids| and |
| 56 // |messages|. If either is NULL, that list is ignored. | 56 // |messages|. If either is NULL, that list is ignored. |
| 57 static void AddSocketHostPermissions(const SocketPermissionEntrySet& sockets, | 57 static void AddSocketHostPermissions(const SocketPermissionEntrySet& sockets, |
| 58 PermissionIDSet* ids); | 58 PermissionIDSet* ids); |
| 59 | 59 |
| 60 SocketPermissionEntrySet permissions_; | 60 SocketPermissionEntrySet permissions_; |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 } // namespace extensions | 63 } // namespace extensions |
| 64 | 64 |
| 65 #endif // EXTENSIONS_COMMON_API_SOCKETS_SOCKETS_MANIFEST_PERMISSION_H_ | 65 #endif // EXTENSIONS_COMMON_API_SOCKETS_SOCKETS_MANIFEST_PERMISSION_H_ |
| OLD | NEW |