| OLD | NEW |
| (Empty) | |
| 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. |
| 4 |
| 5 #include "chrome/browser/extensions/test_extension_management_policy.h" |
| 6 |
| 7 #include "base/utf_string_conversions.h" |
| 8 |
| 9 // *** comment here |
| 10 TestExtensionManagementPolicyDelegate:: |
| 11 TestExtensionManagementPolicyDelegate() : may_install_(true), |
| 12 may_modify_status_(true), |
| 13 may_modify_usage_(true), |
| 14 must_remain_enabled_(false) { |
| 15 error_message_ = UTF8ToUTF16(expected_error()); |
| 16 } |
| 17 |
| 18 TestExtensionManagementPolicyDelegate:: |
| 19 TestExtensionManagementPolicyDelegate(int allowed_actions) { |
| 20 SetAllowedActions(allowed_actions); |
| 21 error_message_ = UTF8ToUTF16(expected_error()); |
| 22 } |
| 23 |
| 24 void TestExtensionManagementPolicyDelegate::SetAllowedActions( |
| 25 int allowed_actions) { |
| 26 may_install_ = (allowed_actions & PROHIBIT_INSTALL) == 0; |
| 27 may_modify_status_ = (allowed_actions & PROHIBIT_MODIFY_STATUS) == 0; |
| 28 may_modify_usage_ = (allowed_actions & PROHIBIT_MODIFY_USAGE) == 0; |
| 29 must_remain_enabled_ = (allowed_actions & MUST_REMAIN_ENABLED) != 0; |
| 30 } |
| 31 |
| 32 bool TestExtensionManagementPolicyDelegate::UserMayInstall( |
| 33 const std::string& extension_id, |
| 34 Extension::Location location, |
| 35 const std::string& extension_name, |
| 36 string16* error) const { |
| 37 if (error && !may_install_) |
| 38 *error = error_message_; |
| 39 return may_install_; |
| 40 } |
| 41 |
| 42 bool TestExtensionManagementPolicyDelegate::UserMayModifyStatus( |
| 43 const Extension* extension, string16* error) const { |
| 44 if (error && !may_modify_status_) |
| 45 *error = error_message_; |
| 46 return may_modify_status_; |
| 47 } |
| 48 |
| 49 bool TestExtensionManagementPolicyDelegate::UserMayModifyUsage( |
| 50 const Extension* extension, string16* error) const { |
| 51 if (error && !may_modify_usage_) |
| 52 *error = error_message_; |
| 53 return may_modify_usage_; |
| 54 } |
| 55 |
| 56 bool TestExtensionManagementPolicyDelegate::MustRemainEnabled( |
| 57 const Extension* extension, string16* error) const { |
| 58 if (error && must_remain_enabled_) |
| 59 *error = error_message_; |
| 60 return must_remain_enabled_; |
| 61 } |
| OLD | NEW |