summaryrefslogtreecommitdiffstats
path: root/extensions/common/extension.cc
diff options
context:
space:
mode:
authorrdevlin.cronin@chromium.org <rdevlin.cronin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-05 16:16:30 +0000
committerrdevlin.cronin@chromium.org <rdevlin.cronin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-05 16:16:30 +0000
commitd695bb139a93f2c0cab08b1801c2cddba1a39773 (patch)
treeb6ee5cfc101d0506d87200f0b09d6189754834ff /extensions/common/extension.cc
parent32e8a26ae2917d695551f1e37701e0eff52879de (diff)
downloadchromium_src-d695bb139a93f2c0cab08b1801c2cddba1a39773.zip
chromium_src-d695bb139a93f2c0cab08b1801c2cddba1a39773.tar.gz
chromium_src-d695bb139a93f2c0cab08b1801c2cddba1a39773.tar.bz2
Refactor PermissionsData pt1
In this CL, we: - Make PermissionsData not-so-static. Only methods which either don't rely on knowledge of specific permissions or methods to get/create the object are static. - Separate runtime permissions knowledge from manifest parsing (PermissionsData vs PermissionsParser) - Move required/optional permissions access into PermissionsParser. - Handle the locking issues. BUG=379356 TBR=sky@chromium.org (for c/b/ui/, no functional changes) Review URL: https://codereview.chromium.org/309533007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@275142 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'extensions/common/extension.cc')
-rw-r--r--extensions/common/extension.cc17
1 files changed, 10 insertions, 7 deletions
diff --git a/extensions/common/extension.cc b/extensions/common/extension.cc
index 917f67d..91e6f2e 100644
--- a/extensions/common/extension.cc
+++ b/extensions/common/extension.cc
@@ -27,6 +27,7 @@
#include "extensions/common/manifest.h"
#include "extensions/common/manifest_constants.h"
#include "extensions/common/manifest_handler.h"
+#include "extensions/common/manifest_handlers/permissions_parser.h"
#include "extensions/common/permissions/api_permission_set.h"
#include "extensions/common/permissions/permission_set.h"
#include "extensions/common/permissions/permissions_data.h"
@@ -287,15 +288,15 @@ GURL Extension::GetBaseURLFromExtensionId(const std::string& extension_id) {
}
bool Extension::HasAPIPermission(APIPermission::ID permission) const {
- return PermissionsData::HasAPIPermission(this, permission);
+ return PermissionsData::ForExtension(this)->HasAPIPermission(permission);
}
bool Extension::HasAPIPermission(const std::string& permission_name) const {
- return PermissionsData::HasAPIPermission(this, permission_name);
+ return PermissionsData::ForExtension(this)->HasAPIPermission(permission_name);
}
scoped_refptr<const PermissionSet> Extension::GetActivePermissions() const {
- return PermissionsData::GetActivePermissions(this);
+ return PermissionsData::ForExtension(this)->active_permissions();
}
bool Extension::ShowConfigureContextMenus() const {
@@ -541,8 +542,8 @@ bool Extension::InitFromValue(int flags, base::string16* error) {
if (is_app() && !LoadAppFeatures(error))
return false;
- permissions_data_.reset(new PermissionsData);
- if (!permissions_data_->ParsePermissions(this, error))
+ permissions_parser_.reset(new PermissionsParser());
+ if (!permissions_parser_->Parse(this, error))
return false;
if (manifest_->HasKey(keys::kConvertedFromUserScript)) {
@@ -553,10 +554,12 @@ bool Extension::InitFromValue(int flags, base::string16* error) {
if (!LoadSharedFeatures(error))
return false;
+ permissions_parser_->Finalize(this);
+ permissions_parser_.reset();
+
finished_parsing_manifest_ = true;
- permissions_data_->InitializeManifestPermissions(this);
- permissions_data_->FinalizePermissions(this);
+ permissions_data_.reset(new PermissionsData(this));
return true;
}