1 // Copyright 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 EXTENSIONS_COMMON_PERMISSIONS_PERMISSION_MESSAGE_PROVIDER_H_ 6 #define EXTENSIONS_COMMON_PERMISSIONS_PERMISSION_MESSAGE_PROVIDER_H_ 7 8 #include <vector> 9 10 #include "extensions/common/manifest.h" 11 #include "extensions/common/permissions/permission_message.h" 12 13 namespace extensions { 14 15 class PermissionSet; 16 17 // The PermissionMessageProvider interprets permissions, translating them 18 // into warning messages to show to the user. It also determines whether 19 // a new set of permissions entails showing new warning messages. 20 class PermissionMessageProvider { 21 public: 22 PermissionMessageProvider() {} 23 virtual ~PermissionMessageProvider() {} 24 25 // Return the global permission message provider. 26 static const PermissionMessageProvider* Get(); 27 28 // Gets the localized permission messages that represent this set. 29 // The set of permission messages shown varies by extension type. 30 virtual PermissionMessages GetPermissionMessages( 31 const PermissionSet* permissions, 32 Manifest::Type extension_type) const = 0; 33 34 // Gets the localized permission messages that represent this set (represented 35 // as strings). The set of permission messages shown varies by extension type. 36 virtual std::vector<string16> GetWarningMessages( 37 const PermissionSet* permissions, 38 Manifest::Type extension_type) const = 0; 39 40 // Gets the localized permission details for messages that represent this set 41 // (represented as strings). The set of permission messages shown varies by 42 // extension type. 43 virtual std::vector<string16> GetWarningMessagesDetails( 44 const PermissionSet* permissions, 45 Manifest::Type extension_type) const = 0; 46 47 // Returns true if |new_permissions| has a greater privilege level than 48 // |old_permissions|. 49 // Whether certain permissions are considered varies by extension type. 50 virtual bool IsPrivilegeIncrease( 51 const PermissionSet* old_permissions, 52 const PermissionSet* new_permissions, 53 Manifest::Type extension_type) const = 0; 54 }; 55 56 } // namespace extensions 57 58 #endif // EXTENSIONS_COMMON_PERMISSIONS_PERMISSION_MESSAGE_PROVIDER_H_ 59