Make default apps cache multiprofile friendly
[chromium-blink-merge.git] / chrome / browser / extensions / test_management_policy.cc
blob2a64d2f82cd7414ec52af14a4af32287a0b049cf
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
3 // found in the LICENSE file.
5 #include "chrome/browser/extensions/test_management_policy.h"
7 #include "base/strings/utf_string_conversions.h"
9 namespace extensions {
10 TestManagementPolicyProvider::TestManagementPolicyProvider()
11 : may_load_(true),
12 may_modify_status_(true),
13 must_remain_enabled_(false) {
14 error_message_ = UTF8ToUTF16(expected_error());
17 TestManagementPolicyProvider::TestManagementPolicyProvider(
18 int prohibited_actions) {
19 SetProhibitedActions(prohibited_actions);
20 error_message_ = UTF8ToUTF16(expected_error());
23 void TestManagementPolicyProvider::SetProhibitedActions(
24 int prohibited_actions) {
25 may_load_ = (prohibited_actions & PROHIBIT_LOAD) == 0;
26 may_modify_status_ = (prohibited_actions & PROHIBIT_MODIFY_STATUS) == 0;
27 must_remain_enabled_ = (prohibited_actions & MUST_REMAIN_ENABLED) != 0;
30 std::string TestManagementPolicyProvider::GetDebugPolicyProviderName() const {
31 return "the test management policy provider";
34 bool TestManagementPolicyProvider::UserMayLoad(const Extension* extension,
35 string16* error) const {
36 if (error && !may_load_)
37 *error = error_message_;
38 return may_load_;
41 bool TestManagementPolicyProvider::UserMayModifySettings(
42 const Extension* extension, string16* error) const {
43 if (error && !may_modify_status_)
44 *error = error_message_;
45 return may_modify_status_;
48 bool TestManagementPolicyProvider::MustRemainEnabled(const Extension* extension,
49 string16* error) const {
50 if (error && must_remain_enabled_)
51 *error = error_message_;
52 return must_remain_enabled_;
54 } // namespace