1 // Copyright (c) 2013 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 CHROME_COMMON_EXTENSIONS_PERMISSIONS_MEDIA_GALLERIES_PERMISSION_H_
6 #define CHROME_COMMON_EXTENSIONS_PERMISSIONS_MEDIA_GALLERIES_PERMISSION_H_
8 #include "base/basictypes.h"
9 #include "chrome/common/extensions/permissions/media_galleries_permission_data.h"
10 #include "chrome/common/extensions/permissions/set_disjunction_permission.h"
11 #include "extensions/common/permissions/api_permission.h"
13 namespace extensions
{
15 // Media Galleries permissions are as follows:
16 // <media-galleries-permission-pattern>
17 // := <access> | <access> 'allAutoDetected' | 'allAutoDetected'
18 // <access> := 'read' | 'read' <access> | 'read' <secondary-access>
20 // := 'delete' | 'delete' <secondary-access> |
21 // 'delete' <tertiary-access>
23 // := 'copyTo' | 'copyTo' <tertiary-access>
24 class MediaGalleriesPermission
25 : public SetDisjunctionPermission
<MediaGalleriesPermissionData
,
26 MediaGalleriesPermission
> {
28 struct CheckParam
: public APIPermission::CheckParam
{
29 explicit CheckParam(const std::string
& permission
)
30 : permission(permission
) {}
31 const std::string permission
;
34 explicit MediaGalleriesPermission(const APIPermissionInfo
* info
);
35 virtual ~MediaGalleriesPermission();
37 // SetDisjunctionPermission overrides.
38 // MediaGalleriesPermission does additional checks to make sure the
39 // permissions do not contain unknown values.
40 virtual bool FromValue(const base::Value
* value
) OVERRIDE
;
42 // APIPermission overrides.
43 virtual PermissionMessages
GetMessages() const OVERRIDE
;
45 // Permission strings.
46 static const char kAllAutoDetectedPermission
[];
47 static const char kReadPermission
[];
48 static const char kCopyToPermission
[];
49 static const char kDeletePermission
[];
52 } // namespace extensions
54 #endif // CHROME_COMMON_EXTENSIONS_PERMISSIONS_MEDIA_GALLERIES_PERMISSION_H_