| 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_PERMISSIONS_MEDIA_GALLERIES_PERMISSION_DATA_H_ | 5 #ifndef EXTENSIONS_COMMON_PERMISSIONS_MEDIA_GALLERIES_PERMISSION_DATA_H_ |
| 6 #define EXTENSIONS_COMMON_PERMISSIONS_MEDIA_GALLERIES_PERMISSION_DATA_H_ | 6 #define EXTENSIONS_COMMON_PERMISSIONS_MEDIA_GALLERIES_PERMISSION_DATA_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 8 #include <string> | 9 #include <string> |
| 9 | 10 |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "extensions/common/permissions/api_permission.h" | 11 #include "extensions/common/permissions/api_permission.h" |
| 12 | 12 |
| 13 namespace base { | 13 namespace base { |
| 14 class Value; | 14 class Value; |
| 15 } | 15 } |
| 16 | 16 |
| 17 namespace extensions { | 17 namespace extensions { |
| 18 | 18 |
| 19 // A MediaGalleriesPermissionData instance represents a single part of the | 19 // A MediaGalleriesPermissionData instance represents a single part of the |
| 20 // MediaGalleriesPermission. e.g. "read" or "allAutoDetected". | 20 // MediaGalleriesPermission. e.g. "read" or "allAutoDetected". |
| 21 class MediaGalleriesPermissionData { | 21 class MediaGalleriesPermissionData { |
| 22 public: | 22 public: |
| 23 MediaGalleriesPermissionData(); | 23 MediaGalleriesPermissionData(); |
| 24 | 24 |
| 25 // Check if |param| (which must be a MediaGalleriesPermission::CheckParam) | 25 // Check if |param| (which must be a MediaGalleriesPermission::CheckParam) |
| 26 // matches the encapsulated attribute. | 26 // matches the encapsulated attribute. |
| 27 bool Check(const APIPermission::CheckParam* param) const; | 27 bool Check(const APIPermission::CheckParam* param) const; |
| 28 | 28 |
| 29 // Convert |this| into a base::Value. | 29 // Convert |this| into a base::Value. |
| 30 scoped_ptr<base::Value> ToValue() const; | 30 std::unique_ptr<base::Value> ToValue() const; |
| 31 | 31 |
| 32 // Populate |this| from a base::Value. | 32 // Populate |this| from a base::Value. |
| 33 bool FromValue(const base::Value* value); | 33 bool FromValue(const base::Value* value); |
| 34 | 34 |
| 35 bool operator<(const MediaGalleriesPermissionData& rhs) const; | 35 bool operator<(const MediaGalleriesPermissionData& rhs) const; |
| 36 bool operator==(const MediaGalleriesPermissionData& rhs) const; | 36 bool operator==(const MediaGalleriesPermissionData& rhs) const; |
| 37 | 37 |
| 38 std::string permission() const { return permission_; } | 38 std::string permission() const { return permission_; } |
| 39 | 39 |
| 40 // This accessor is provided for IPC_STRUCT_TRAITS_MEMBER. Please think | 40 // This accessor is provided for IPC_STRUCT_TRAITS_MEMBER. Please think |
| 41 // twice before using it for anything else. | 41 // twice before using it for anything else. |
| 42 std::string& permission() { return permission_; } | 42 std::string& permission() { return permission_; } |
| 43 | 43 |
| 44 private: | 44 private: |
| 45 std::string permission_; | 45 std::string permission_; |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 } // namespace extensions | 48 } // namespace extensions |
| 49 | 49 |
| 50 #endif // EXTENSIONS_COMMON_PERMISSIONS_MEDIA_GALLERIES_PERMISSION_DATA_H_ | 50 #endif // EXTENSIONS_COMMON_PERMISSIONS_MEDIA_GALLERIES_PERMISSION_DATA_H_ |
| OLD | NEW |