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

Unified Diff: chrome/common/extensions/extension.cc

Issue 164335: Add a method to classify what permission class an extension is in, with unit (Closed)
Patch Set: Created 11 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/extensions/extension.h ('k') | chrome/common/extensions/extension_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/extension.cc
diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc
index 17fb86730124586dc604da56f8d9e445e5eeac69..e10280cdddac49c7538d926b27afa6f71f2a6033 100644
--- a/chrome/common/extensions/extension.cc
+++ b/chrome/common/extensions/extension.cc
@@ -953,6 +953,25 @@ std::set<FilePath> Extension::GetBrowserImages() {
return image_paths;
}
+Extension::PermissionClass Extension::GetPermissionClass() {
+ // Native code can do anything. Highest class.
+ if (!plugins_.empty())
+ return PERMISSION_CLASS_FULL;
+
+ // Access to other sites means the extension can steal cookies (login data)
+ // from those sites.
+ // TODO(mpcomplete): should we only classify for host access outside the
+ // extension's origin? how?
+ if (!host_permissions_.empty() || !content_scripts_.empty())
+ return PERMISSION_CLASS_HIGH;
+
+ // Extension can access history data, bookmarks, other personal info.
+ if (!api_permissions_.empty())
+ return PERMISSION_CLASS_MEDIUM;
+
+ return PERMISSION_CLASS_LOW;
+}
+
bool Extension::GetBackgroundPageReady() {
return background_page_ready_ || background_url().is_empty();
}
« no previous file with comments | « chrome/common/extensions/extension.h ('k') | chrome/common/extensions/extension_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698