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
3 // found in the LICENSE file.
5 #ifndef EXTENSIONS_COMMON_PERMISSIONS_MEDIA_GALLERIES_PERMISSION_DATA_H_
6 #define EXTENSIONS_COMMON_PERMISSIONS_MEDIA_GALLERIES_PERMISSION_DATA_H_
10 #include "base/basictypes.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "extensions/common/permissions/api_permission.h"
18 namespace extensions
{
20 // A MediaGalleriesPermissionData instance represents a single part of the
21 // MediaGalleriesPermission. e.g. "read" or "allAutoDetected".
22 class MediaGalleriesPermissionData
{
24 MediaGalleriesPermissionData();
26 // Check if |param| (which must be a MediaGalleriesPermission::CheckParam)
27 // matches the encapsulated attribute.
28 bool Check(const APIPermission::CheckParam
* param
) const;
30 // Convert |this| into a base::Value.
31 scoped_ptr
<base::Value
> ToValue() const;
33 // Populate |this| from a base::Value.
34 bool FromValue(const base::Value
* value
);
36 bool operator<(const MediaGalleriesPermissionData
& rhs
) const;
37 bool operator==(const MediaGalleriesPermissionData
& rhs
) const;
39 std::string
permission() const { return permission_
; }
41 // This accessor is provided for IPC_STRUCT_TRAITS_MEMBER. Please think
42 // twice before using it for anything else.
43 std::string
& permission() { return permission_
; }
46 std::string permission_
;
49 } // namespace extensions
51 #endif // EXTENSIONS_COMMON_PERMISSIONS_MEDIA_GALLERIES_PERMISSION_DATA_H_