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

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

Issue 54903011: Add management policy function allowing extensions to be disabled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: responded to review comments Created 7 years, 1 month 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/test_management_policy.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/test_management_policy.cc
diff --git a/chrome/browser/extensions/test_management_policy.cc b/chrome/browser/extensions/test_management_policy.cc
index 2a64d2f82cd7414ec52af14a4af32287a0b049cf..c1c69ac856bc6413c21d733ea5eba25d8e8d1482 100644
--- a/chrome/browser/extensions/test_management_policy.cc
+++ b/chrome/browser/extensions/test_management_policy.cc
@@ -7,10 +7,13 @@
#include "base/strings/utf_string_conversions.h"
namespace extensions {
+
TestManagementPolicyProvider::TestManagementPolicyProvider()
: may_load_(true),
may_modify_status_(true),
- must_remain_enabled_(false) {
+ must_remain_enabled_(false),
+ must_remain_disabled_(false),
+ disable_reason_(Extension::DISABLE_NONE) {
error_message_ = UTF8ToUTF16(expected_error());
}
@@ -25,6 +28,12 @@ void TestManagementPolicyProvider::SetProhibitedActions(
may_load_ = (prohibited_actions & PROHIBIT_LOAD) == 0;
may_modify_status_ = (prohibited_actions & PROHIBIT_MODIFY_STATUS) == 0;
must_remain_enabled_ = (prohibited_actions & MUST_REMAIN_ENABLED) != 0;
+ must_remain_disabled_ = (prohibited_actions & MUST_REMAIN_DISABLED) != 0;
+}
+
+void TestManagementPolicyProvider::SetDisableReason(
+ Extension::DisableReason reason) {
+ disable_reason_ = reason;
}
std::string TestManagementPolicyProvider::GetDebugPolicyProviderName() const {
@@ -51,4 +60,19 @@ bool TestManagementPolicyProvider::MustRemainEnabled(const Extension* extension,
*error = error_message_;
return must_remain_enabled_;
}
-} // namespace
+
+bool TestManagementPolicyProvider::MustRemainDisabled(
+ const Extension* extension,
+ Extension::DisableReason* reason,
+ string16* error) const {
+ if (must_remain_disabled_) {
+ if (error)
+ *error = error_message_;
+ if (reason)
+ *reason = disable_reason_;
+ }
+ return must_remain_disabled_;
+}
+
+
+} // namespace extensions
« no previous file with comments | « chrome/browser/extensions/test_management_policy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698