Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(148)

Side by Side Diff: chrome/common/extensions/permissions/chrome_permission_message_provider.h

Issue 1006453002: Extensions: Prepare switch to new permission message system (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: format Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_COMMON_EXTENSIONS_PERMISSIONS_CHROME_PERMISSION_MESSAGE_PROVIDER_ H_ 5 #ifndef CHROME_COMMON_EXTENSIONS_PERMISSIONS_CHROME_PERMISSION_MESSAGE_PROVIDER_ H_
6 #define CHROME_COMMON_EXTENSIONS_PERMISSIONS_CHROME_PERMISSION_MESSAGE_PROVIDER_ H_ 6 #define CHROME_COMMON_EXTENSIONS_PERMISSIONS_CHROME_PERMISSION_MESSAGE_PROVIDER_ H_
7 7
8 #include <set> 8 #include <set>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/gtest_prod_util.h" 11 #include "base/gtest_prod_util.h"
12 #include "base/strings/string16.h" 12 #include "base/strings/string16.h"
13 #include "extensions/common/permissions/permission_message_provider.h" 13 #include "extensions/common/permissions/permission_message_provider.h"
14 14
15 namespace extensions { 15 namespace extensions {
16 16
17 // Tested in two places: 17 // Tested in two places:
18 // 1. chrome_permission_message_provider_unittest.cc, which is a regular unit 18 // 1. chrome_permission_message_provider_unittest.cc, which is a regular unit
19 // test for this class 19 // test for this class
20 // 2. chrome/browser/extensions/permission_messages_unittest.cc, which is an 20 // 2. chrome/browser/extensions/permission_messages_unittest.cc, which is an
21 // integration test that ensures messages are correctly generated for 21 // integration test that ensures messages are correctly generated for
22 // extensions created through the extension system. 22 // extensions created through the extension system.
23 class ChromePermissionMessageProvider : public PermissionMessageProvider { 23 class ChromePermissionMessageProvider : public PermissionMessageProvider {
24 public: 24 public:
25 ChromePermissionMessageProvider(); 25 ChromePermissionMessageProvider();
26 ~ChromePermissionMessageProvider() override; 26 ~ChromePermissionMessageProvider() override;
27 27
28 // PermissionMessageProvider implementation. 28 // PermissionMessageProvider implementation.
Yoyo Zhou 2015/03/12 20:55:57 Add some comments here about the legacy-ness of va
Marc Treib 2015/03/13 10:43:09 There are already comments to that effect in permi
Yoyo Zhou 2015/03/13 18:08:13 Ah, sorry; don't know how I missed that.
29 PermissionMessages GetPermissionMessages( 29 PermissionMessageStrings GetPermissionMessageStrings(
30 const PermissionSet* permissions,
31 Manifest::Type extension_type) const override;
32 PermissionMessageIDs GetLegacyPermissionMessageIDs(
30 const PermissionSet* permissions, 33 const PermissionSet* permissions,
31 Manifest::Type extension_type) const override; 34 Manifest::Type extension_type) const override;
32 CoalescedPermissionMessages GetCoalescedPermissionMessages( 35 CoalescedPermissionMessages GetCoalescedPermissionMessages(
33 const PermissionIDSet& permissions) const override; 36 const PermissionIDSet& permissions) const override;
34 std::vector<base::string16> GetWarningMessages( 37 std::vector<base::string16> GetLegacyWarningMessages(
35 const PermissionSet* permissions, 38 const PermissionSet* permissions,
36 Manifest::Type extension_type) const override; 39 Manifest::Type extension_type) const override;
37 std::vector<base::string16> GetWarningMessagesDetails( 40 std::vector<base::string16> GetLegacyWarningMessagesDetails(
38 const PermissionSet* permissions, 41 const PermissionSet* permissions,
39 Manifest::Type extension_type) const override; 42 Manifest::Type extension_type) const override;
40 bool IsPrivilegeIncrease(const PermissionSet* old_permissions, 43 bool IsPrivilegeIncrease(const PermissionSet* old_permissions,
41 const PermissionSet* new_permissions, 44 const PermissionSet* new_permissions,
42 Manifest::Type extension_type) const override; 45 Manifest::Type extension_type) const override;
43 PermissionIDSet GetAllPermissionIDs( 46 PermissionIDSet GetAllPermissionIDs(
44 const PermissionSet* permissions, 47 const PermissionSet* permissions,
45 Manifest::Type extension_type) const override; 48 Manifest::Type extension_type) const override;
46 49
47 private: 50 private:
51 // TODO(treib): Remove this once we've switched to the new system.
52 PermissionMessages GetPermissionMessages(const PermissionSet* permissions,
53 Manifest::Type extension_type) const;
54
48 // Gets the permission messages for the API permissions. Also adds any 55 // Gets the permission messages for the API permissions. Also adds any
49 // permission IDs from API Permissions to |permission_ids|. 56 // permission IDs from API Permissions to |permission_ids|.
50 // TODO(sashab): Deprecate the |permissions| argument, and rename this to 57 // TODO(sashab): Deprecate the |permissions| argument, and rename this to
51 // AddAPIPermissions(). 58 // AddAPIPermissions().
52 std::set<PermissionMessage> GetAPIPermissionMessages( 59 std::set<PermissionMessage> GetAPIPermissionMessages(
53 const PermissionSet* permissions, 60 const PermissionSet* permissions,
54 PermissionIDSet* permission_ids) const; 61 PermissionIDSet* permission_ids) const;
55 62
56 // Gets the permission messages for the Manifest permissions. Also adds any 63 // Gets the permission messages for the Manifest permissions. Also adds any
57 // permission IDs from manifest Permissions to |permission_ids|. 64 // permission IDs from manifest Permissions to |permission_ids|.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 const PermissionSet* old_permissions, 105 const PermissionSet* old_permissions,
99 const PermissionSet* new_permissions, 106 const PermissionSet* new_permissions,
100 Manifest::Type extension_type) const; 107 Manifest::Type extension_type) const;
101 108
102 DISALLOW_COPY_AND_ASSIGN(ChromePermissionMessageProvider); 109 DISALLOW_COPY_AND_ASSIGN(ChromePermissionMessageProvider);
103 }; 110 };
104 111
105 } // namespace extensions 112 } // namespace extensions
106 113
107 #endif // CHROME_COMMON_EXTENSIONS_PERMISSIONS_CHROME_PERMISSION_MESSAGE_PROVID ER_H_ 114 #endif // CHROME_COMMON_EXTENSIONS_PERMISSIONS_CHROME_PERMISSION_MESSAGE_PROVID ER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698