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. 4 5 #ifndef CHROME_COMMON_EXTENSIONS_PERMISSIONS_MEDIA_GALLERIES_PERMISSION_H_ 6 #define CHROME_COMMON_EXTENSIONS_PERMISSIONS_MEDIA_GALLERIES_PERMISSION_H_ 7 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" 12 13 namespace extensions { 14 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> 19 // <secondary-access> 20 // := 'delete' | 'delete' <secondary-access> | 21 // 'delete' <tertiary-access> 22 // <tertiary-access> 23 // := 'copyTo' | 'copyTo' <tertiary-access> 24 class MediaGalleriesPermission 25 : public SetDisjunctionPermission<MediaGalleriesPermissionData, 26 MediaGalleriesPermission> { 27 public: 28 struct CheckParam : public APIPermission::CheckParam { 29 explicit CheckParam(const std::string& permission) 30 : permission(permission) {} 31 const std::string permission; 32 }; 33 34 explicit MediaGalleriesPermission(const APIPermissionInfo* info); 35 virtual ~MediaGalleriesPermission(); 36 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; 41 42 // APIPermission overrides. 43 virtual PermissionMessages GetMessages() const OVERRIDE; 44 45 // Permission strings. 46 static const char kAllAutoDetectedPermission[]; 47 static const char kReadPermission[]; 48 static const char kCopyToPermission[]; 49 static const char kDeletePermission[]; 50 }; 51 52 } // namespace extensions 53 54 #endif // CHROME_COMMON_EXTENSIONS_PERMISSIONS_MEDIA_GALLERIES_PERMISSION_H_ 55