1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/extensions/standard_management_policy_provider.h"
7 #include "base/prefs/pref_service.h"
8 #include "chrome/browser/extensions/blacklist.h"
9 #include "chrome/common/pref_names.h"
10 #include "extensions/browser/admin_policy.h"
11 #include "extensions/browser/extension_prefs.h"
12 #include "extensions/browser/pref_names.h"
13 #include "extensions/common/extension.h"
15 namespace extensions
{
17 StandardManagementPolicyProvider::StandardManagementPolicyProvider(
18 ExtensionPrefs
* prefs
)
22 StandardManagementPolicyProvider::~StandardManagementPolicyProvider() {
26 StandardManagementPolicyProvider::GetDebugPolicyProviderName() const {
31 return "admin policy black/white/forcelist, via the ExtensionPrefs";
35 bool StandardManagementPolicyProvider::UserMayLoad(
36 const Extension
* extension
,
37 base::string16
* error
) const {
38 PrefService
* pref_service
= prefs_
->pref_service();
40 const base::ListValue
* blacklist
=
41 pref_service
->GetList(pref_names::kInstallDenyList
);
42 const base::ListValue
* whitelist
=
43 pref_service
->GetList(pref_names::kInstallAllowList
);
44 const base::DictionaryValue
* forcelist
=
45 pref_service
->GetDictionary(pref_names::kInstallForceList
);
46 const base::ListValue
* allowed_types
= NULL
;
47 if (pref_service
->HasPrefPath(pref_names::kAllowedTypes
))
48 allowed_types
= pref_service
->GetList(pref_names::kAllowedTypes
);
50 return admin_policy::UserMayLoad(
51 blacklist
, whitelist
, forcelist
, allowed_types
, extension
, error
);
54 bool StandardManagementPolicyProvider::UserMayModifySettings(
55 const Extension
* extension
,
56 base::string16
* error
) const {
57 return admin_policy::UserMayModifySettings(extension
, error
);
60 bool StandardManagementPolicyProvider::MustRemainEnabled(
61 const Extension
* extension
,
62 base::string16
* error
) const {
63 return admin_policy::MustRemainEnabled(extension
, error
);
66 } // namespace extensions