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

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

Issue 51433002: Enable permission warnings from ManifestHandlers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebasing. Created 7 years, 1 month 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 (c) 2013 The Chromium Authors. All rights reserved. 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 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_PERMISSIONS_DATA_H_ 5 #ifndef CHROME_COMMON_EXTENSIONS_PERMISSIONS_PERMISSIONS_DATA_H_
6 #define CHROME_COMMON_EXTENSIONS_PERMISSIONS_PERMISSIONS_DATA_H_ 6 #define CHROME_COMMON_EXTENSIONS_PERMISSIONS_PERMISSIONS_DATA_H_
7 7
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/strings/string16.h" 13 #include "base/strings/string16.h"
14 #include "base/synchronization/lock.h" 14 #include "base/synchronization/lock.h"
15 #include "extensions/common/permissions/api_permission.h" 15 #include "extensions/common/permissions/api_permission.h"
16 #include "extensions/common/permissions/permission_message.h" 16 #include "extensions/common/permissions/permission_message.h"
17 17
18 class GURL; 18 class GURL;
19 19
20 namespace extensions { 20 namespace extensions {
21 21
22 class PermissionSet; 22 class PermissionSet;
23 class APIPermissionSet; 23 class APIPermissionSet;
24 class Extension; 24 class Extension;
25 class ManifestPermissionSet;
25 class URLPatternSet; 26 class URLPatternSet;
26 class UserScript; 27 class UserScript;
27 28
28 // A container for the permissions data of the extension; also responsible for 29 // A container for the permissions data of the extension; also responsible for
29 // parsing the "permissions" and "optional_permissions" manifest keys. This 30 // parsing the "permissions" and "optional_permissions" manifest keys. This
30 // class also contains the active (runtime) permissions for the extension. 31 // class also contains the active (runtime) permissions for the extension.
31 class PermissionsData { 32 class PermissionsData {
32 public: 33 public:
33 PermissionsData(); 34 PermissionsData();
34 ~PermissionsData(); 35 ~PermissionsData();
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 // is restricted to the extension's host permissions as well as the 174 // is restricted to the extension's host permissions as well as the
174 // extension page itself. 175 // extension page itself.
175 static bool CanCaptureVisiblePage(const Extension* extension, 176 static bool CanCaptureVisiblePage(const Extension* extension,
176 const GURL& page_url, 177 const GURL& page_url,
177 int tab_id, 178 int tab_id,
178 std::string* error); 179 std::string* error);
179 180
180 // Parse the permissions of a given extension in the initialization process. 181 // Parse the permissions of a given extension in the initialization process.
181 bool ParsePermissions(Extension* extension, string16* error); 182 bool ParsePermissions(Extension* extension, string16* error);
182 183
184 // Ensure manifest handlers provide their custom manifest permissions.
185 void InitializeManifestPermissions(Extension* extension);
186
183 // Finalize permissions after the initialization process completes. 187 // Finalize permissions after the initialization process completes.
184 void FinalizePermissions(Extension* extension); 188 void FinalizePermissions(Extension* extension);
185 189
186 private: 190 private:
187 struct InitialPermissions; 191 struct InitialPermissions;
188 typedef std::map<int, scoped_refptr<const PermissionSet> > TabPermissionsMap; 192 typedef std::map<int, scoped_refptr<const PermissionSet> > TabPermissionsMap;
189 193
190 // Temporary permissions during the initialization process; NULL after 194 // Temporary permissions during the initialization process; NULL after
191 // initialization completes. 195 // initialization completes.
192 scoped_ptr<InitialPermissions> initial_required_permissions_; 196 scoped_ptr<InitialPermissions> initial_required_permissions_;
(...skipping 12 matching lines...) Expand all
205 mutable scoped_refptr<const PermissionSet> active_permissions_; 209 mutable scoped_refptr<const PermissionSet> active_permissions_;
206 210
207 mutable TabPermissionsMap tab_specific_permissions_; 211 mutable TabPermissionsMap tab_specific_permissions_;
208 212
209 DISALLOW_COPY_AND_ASSIGN(PermissionsData); 213 DISALLOW_COPY_AND_ASSIGN(PermissionsData);
210 }; 214 };
211 215
212 } // namespace extensions 216 } // namespace extensions
213 217
214 #endif // CHROME_COMMON_EXTENSIONS_PERMISSIONS_PERMISSIONS_DATA_H_ 218 #endif // CHROME_COMMON_EXTENSIONS_PERMISSIONS_PERMISSIONS_DATA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698