Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / extensions / common / permissions / media_galleries_permission.h
blob0276454944b65623d237851940f9b2f67c0e6734
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_H_
6 #define EXTENSIONS_COMMON_PERMISSIONS_MEDIA_GALLERIES_PERMISSION_H_
8 #include "base/basictypes.h"
9 #include "extensions/common/permissions/api_permission.h"
10 #include "extensions/common/permissions/media_galleries_permission_data.h"
11 #include "extensions/common/permissions/set_disjunction_permission.h"
13 namespace extensions {
15 // Media Galleries permissions are as follows:
16 // <media-galleries-permission-pattern>
17 // := <access> | <access> 'allAutoDetected' | 'allAutoDetected' |
18 // <access> 'scan' | 'scan'
19 // <access> := 'read' | 'read' <access> | 'read' <secondary-access>
20 // <secondary-access>
21 // := 'delete' | 'delete' <secondary-access> |
22 // 'delete' <tertiary-access>
23 // <tertiary-access>
24 // := 'copyTo' | 'copyTo' <tertiary-access>
25 class MediaGalleriesPermission
26 : public SetDisjunctionPermission<MediaGalleriesPermissionData,
27 MediaGalleriesPermission> {
28 public:
29 struct CheckParam : public APIPermission::CheckParam {
30 explicit CheckParam(const std::string& permission)
31 : permission(permission) {}
32 const std::string permission;
35 explicit MediaGalleriesPermission(const APIPermissionInfo* info);
36 ~MediaGalleriesPermission() override;
38 // SetDisjunctionPermission overrides.
39 // MediaGalleriesPermission does additional checks to make sure the
40 // permissions do not contain unknown values.
41 bool FromValue(const base::Value* value,
42 std::string* error,
43 std::vector<std::string>* unhandled_permissions) override;
45 // APIPermission overrides.
46 PermissionIDSet GetPermissions() const override;
48 // Permission strings.
49 static const char kAllAutoDetectedPermission[];
50 static const char kScanPermission[];
51 static const char kReadPermission[];
52 static const char kCopyToPermission[];
53 static const char kDeletePermission[];
56 } // namespace extensions
58 #endif // EXTENSIONS_COMMON_PERMISSIONS_MEDIA_GALLERIES_PERMISSION_H_