OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/extensions/management_policy.h" | 5 #include "chrome/browser/extensions/management_policy.h" |
6 | 6 |
7 namespace extensions { | 7 namespace extensions { |
8 | 8 |
9 namespace { | 9 namespace { |
10 | 10 |
(...skipping 21 matching lines...) Expand all Loading... |
32 bool ManagementPolicy::Provider::UserMayModifySettings( | 32 bool ManagementPolicy::Provider::UserMayModifySettings( |
33 const Extension* extension, string16* error) const { | 33 const Extension* extension, string16* error) const { |
34 return true; | 34 return true; |
35 } | 35 } |
36 | 36 |
37 bool ManagementPolicy::Provider::MustRemainEnabled(const Extension* extension, | 37 bool ManagementPolicy::Provider::MustRemainEnabled(const Extension* extension, |
38 string16* error) const { | 38 string16* error) const { |
39 return false; | 39 return false; |
40 } | 40 } |
41 | 41 |
| 42 bool ManagementPolicy::Provider::MustRemainDisabled( |
| 43 const Extension* extension, |
| 44 Extension::DisableReason* reason, |
| 45 string16* error) const { |
| 46 return false; |
| 47 } |
| 48 |
42 void ManagementPolicy::RegisterProvider(Provider* provider) { | 49 void ManagementPolicy::RegisterProvider(Provider* provider) { |
43 providers_.insert(provider); | 50 providers_.insert(provider); |
44 } | 51 } |
45 | 52 |
46 void ManagementPolicy::UnregisterProvider(Provider* provider) { | 53 void ManagementPolicy::UnregisterProvider(Provider* provider) { |
47 providers_.erase(provider); | 54 providers_.erase(provider); |
48 } | 55 } |
49 | 56 |
50 bool ManagementPolicy::UserMayLoad(const Extension* extension, | 57 bool ManagementPolicy::UserMayLoad(const Extension* extension, |
51 string16* error) const { | 58 string16* error) const { |
52 return ApplyToProviderList(&Provider::UserMayLoad, "Installation", | 59 return ApplyToProviderList(&Provider::UserMayLoad, "Installation", |
53 true, extension, error); | 60 true, extension, error); |
54 } | 61 } |
55 | 62 |
56 bool ManagementPolicy::UserMayModifySettings(const Extension* extension, | 63 bool ManagementPolicy::UserMayModifySettings(const Extension* extension, |
57 string16* error) const { | 64 string16* error) const { |
58 return ApplyToProviderList(&Provider::UserMayModifySettings, "Modification", | 65 return ApplyToProviderList(&Provider::UserMayModifySettings, "Modification", |
59 true, extension, error); | 66 true, extension, error); |
60 } | 67 } |
61 | 68 |
62 bool ManagementPolicy::MustRemainEnabled(const Extension* extension, | 69 bool ManagementPolicy::MustRemainEnabled(const Extension* extension, |
63 string16* error) const { | 70 string16* error) const { |
64 return ApplyToProviderList(&Provider::MustRemainEnabled, "Disabling", | 71 return ApplyToProviderList(&Provider::MustRemainEnabled, "Disabling", |
65 false, extension, error); | 72 false, extension, error); |
66 } | 73 } |
67 | 74 |
| 75 bool ManagementPolicy::MustRemainDisabled(const Extension* extension, |
| 76 Extension::DisableReason* reason, |
| 77 string16* error) const { |
| 78 for (ProviderList::const_iterator it = providers_.begin(); |
| 79 it != providers_.end(); ++it) |
| 80 if ((*it)->MustRemainDisabled(extension, reason, error)) |
| 81 return true; |
| 82 |
| 83 return false; |
| 84 } |
| 85 |
68 void ManagementPolicy::UnregisterAllProviders() { | 86 void ManagementPolicy::UnregisterAllProviders() { |
69 providers_.clear(); | 87 providers_.clear(); |
70 } | 88 } |
71 | 89 |
72 int ManagementPolicy::GetNumProviders() const { | 90 int ManagementPolicy::GetNumProviders() const { |
73 return providers_.size(); | 91 return providers_.size(); |
74 } | 92 } |
75 | 93 |
76 bool ManagementPolicy::ApplyToProviderList(ProviderFunction function, | 94 bool ManagementPolicy::ApplyToProviderList(ProviderFunction function, |
77 const char* debug_operation_name, | 95 const char* debug_operation_name, |
(...skipping 11 matching lines...) Expand all Loading... |
89 DVLOG(1) << debug_operation_name << " of extension " << name | 107 DVLOG(1) << debug_operation_name << " of extension " << name |
90 << " (" << id << ")" | 108 << " (" << id << ")" |
91 << " prohibited by " << provider->GetDebugPolicyProviderName(); | 109 << " prohibited by " << provider->GetDebugPolicyProviderName(); |
92 return !normal_result; | 110 return !normal_result; |
93 } | 111 } |
94 } | 112 } |
95 return normal_result; | 113 return normal_result; |
96 } | 114 } |
97 | 115 |
98 } // namespace extensions | 116 } // namespace extensions |
OLD | NEW |