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

Unified Diff: chrome/browser/extensions/extension_webstore_private_api.cc

Issue 9317013: Add a centralized mechanism for whitelisting access to extension permissions. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: . Created 8 years, 10 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/browser/extensions/extension_web_socket_proxy_private_apitest.cc ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_webstore_private_api.cc
diff --git a/chrome/browser/extensions/extension_webstore_private_api.cc b/chrome/browser/extensions/extension_webstore_private_api.cc
index 8f393a5e9ea18356d4063629d75fa73f0c9c93d2..9d66238a9d21056a36c50e1a35bf042ce9f1f753 100644
--- a/chrome/browser/extensions/extension_webstore_private_api.cc
+++ b/chrome/browser/extensions/extension_webstore_private_api.cc
@@ -53,8 +53,6 @@ const char kInvalidManifestError[] = "Invalid manifest";
const char kNoPreviousBeginInstallWithManifestError[] =
"* does not match a previous call to beginInstallWithManifest3";
const char kUserCancelledError[] = "User cancelled install";
-const char kPermissionDeniedError[] =
- "You do not have permission to use this method.";
ProfileSyncService* test_sync_service = NULL;
@@ -68,17 +66,6 @@ ProfileSyncService* GetSyncService(Profile* profile) {
return ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile);
}
-bool IsWebStoreURL(Profile* profile, const GURL& url) {
- ExtensionService* service = profile->GetExtensionService();
- const Extension* store = service->GetWebStoreApp();
- if (!store) {
- NOTREACHED();
- return false;
- }
- return (service->extensions()->GetHostedAppByURL(ExtensionURLInfo(url)) ==
- store);
-}
-
// Whitelists extension IDs for use by webstorePrivate.silentlyInstall.
bool trust_test_ids = false;
@@ -151,11 +138,6 @@ BeginInstallWithManifestFunction::BeginInstallWithManifestFunction()
BeginInstallWithManifestFunction::~BeginInstallWithManifestFunction() {}
bool BeginInstallWithManifestFunction::RunImpl() {
- if (!IsWebStoreURL(profile_, source_url())) {
- SetResult(PERMISSION_DENIED);
- return false;
- }
-
DictionaryValue* details = NULL;
EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(0, &details));
CHECK(details);
@@ -352,9 +334,6 @@ void BeginInstallWithManifestFunction::InstallUIAbort(bool user_initiated) {
}
bool CompleteInstallFunction::RunImpl() {
- if (!IsWebStoreURL(profile_, source_url()))
- return false;
-
std::string id;
EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &id));
if (!Extension::IdIsValid(id)) {
@@ -385,11 +364,6 @@ SilentlyInstallFunction::SilentlyInstallFunction() {}
SilentlyInstallFunction::~SilentlyInstallFunction() {}
bool SilentlyInstallFunction::RunImpl() {
- if (!IsWebStoreURL(profile_, source_url())) {
- error_ = kPermissionDeniedError;
- return false;
- }
-
DictionaryValue* details = NULL;
EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(0, &details));
CHECK(details);
@@ -465,15 +439,11 @@ void SilentlyInstallFunction::OnExtensionInstallFailure(
}
bool GetBrowserLoginFunction::RunImpl() {
- if (!IsWebStoreURL(profile_, source_url()))
- return false;
result_.reset(CreateLoginResult(profile_->GetOriginalProfile()));
return true;
}
bool GetStoreLoginFunction::RunImpl() {
- if (!IsWebStoreURL(profile_, source_url()))
- return false;
ExtensionService* service = profile_->GetExtensionService();
ExtensionPrefs* prefs = service->extension_prefs();
std::string login;
@@ -486,8 +456,6 @@ bool GetStoreLoginFunction::RunImpl() {
}
bool SetStoreLoginFunction::RunImpl() {
- if (!IsWebStoreURL(profile_, source_url()))
- return false;
std::string login;
EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &login));
ExtensionService* service = profile_->GetExtensionService();
« no previous file with comments | « chrome/browser/extensions/extension_web_socket_proxy_private_apitest.cc ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698