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

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

Issue 602803002: Refactor ExtensionManagement (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ext-fix
Patch Set: fix addressing #7 Created 6 years, 3 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_management_unittest.cc ('k') | chrome/chrome_browser_extensions.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/standard_management_policy_provider.cc
diff --git a/chrome/browser/extensions/standard_management_policy_provider.cc b/chrome/browser/extensions/standard_management_policy_provider.cc
index f2824064067202e033b9105c9d4e03c45bc816f3..0212257468d1e8f6870e3d71511f0ddeb430d3c5 100644
--- a/chrome/browser/extensions/standard_management_policy_provider.cc
+++ b/chrome/browser/extensions/standard_management_policy_provider.cc
@@ -4,7 +4,6 @@
#include "chrome/browser/extensions/standard_management_policy_provider.h"
-#include <algorithm>
#include <string>
#include "base/logging.h"
@@ -77,16 +76,12 @@ bool StandardManagementPolicyProvider::UserMayLoad(
if (Manifest::IsComponentLocation(extension->location()))
return true;
- // Fields in |by_id| will automatically fall back to default settings if
- // they are not specified by policy.
- const ExtensionManagement::IndividualSettings& by_id =
- settings_->ReadById(extension->id());
- const ExtensionManagement::GlobalSettings& global =
- settings_->ReadGlobalSettings();
+ ExtensionManagement::InstallationMode installation_mode =
+ settings_->GetInstallationMode(extension->id());
// Force-installed extensions cannot be overwritten manually.
if (!Manifest::IsPolicyLocation(extension->location()) &&
- by_id.installation_mode == ExtensionManagement::INSTALLATION_FORCED) {
+ installation_mode == ExtensionManagement::INSTALLATION_FORCED) {
return ReturnLoadError(extension, error);
}
@@ -107,19 +102,15 @@ bool StandardManagementPolicyProvider::UserMayLoad(
case Manifest::TYPE_LEGACY_PACKAGED_APP:
case Manifest::TYPE_PLATFORM_APP:
case Manifest::TYPE_SHARED_MODULE: {
- if (global.has_restricted_allowed_types &&
- std::find(global.allowed_types.begin(),
- global.allowed_types.end(),
- extension->GetType()) == global.allowed_types.end()) {
+ if (!settings_->IsAllowedManifestType(extension->GetType()))
return ReturnLoadError(extension, error);
- }
break;
}
case Manifest::NUM_LOAD_TYPES:
NOTREACHED();
}
- if (by_id.installation_mode == ExtensionManagement::INSTALLATION_BLOCKED)
+ if (installation_mode == ExtensionManagement::INSTALLATION_BLOCKED)
return ReturnLoadError(extension, error);
return true;
« no previous file with comments | « chrome/browser/extensions/extension_management_unittest.cc ('k') | chrome/chrome_browser_extensions.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698