Chromium Code Reviews
|
| 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/extension_management_policy.h" | |
| 6 | |
| 7 ExtensionManagementPolicy::ExtensionManagementPolicy() { | |
| 8 } | |
| 9 | |
| 10 ExtensionManagementPolicy::~ExtensionManagementPolicy() { | |
| 11 } | |
| 12 | |
| 13 bool ExtensionManagementPolicy::Delegate::UserMayInstall( | |
| 14 const std::string& extension_id, | |
| 15 Extension::Location location, | |
| 16 const std::string& extension_name, | |
| 17 string16* error) const { | |
| 18 return true; | |
| 19 } | |
| 20 | |
| 21 // Enable, disable, remove | |
| 22 bool ExtensionManagementPolicy::Delegate::UserMayModifyStatus( | |
| 23 const Extension* extension, string16* error) const { | |
| 24 return true; | |
| 25 } | |
| 26 // Incognito, file access, etc. | |
| 27 bool ExtensionManagementPolicy::Delegate::UserMayModifyUsage( | |
| 28 const Extension* extension, string16* error) const { | |
| 29 return true; | |
| 30 } | |
| 31 | |
| 32 // Forced on | |
| 33 bool ExtensionManagementPolicy::Delegate::MustRemainEnabled( | |
| 34 const Extension* extension, string16* error) const { | |
| 35 return false; | |
| 36 } | |
| 37 | |
| 38 void ExtensionManagementPolicy::RegisterDelegate(Delegate* delegate) { | |
| 39 delegates_.insert(delegate); | |
| 40 } | |
| 41 | |
| 42 void ExtensionManagementPolicy::UnregisterDelegate(Delegate* delegate) { | |
| 43 delegates_.erase(delegate); | |
| 44 } | |
| 45 | |
| 46 bool ExtensionManagementPolicy::UserMayInstall(const std::string& extension_id, | |
| 47 Extension::Location location, const std::string& extension_name, | |
| 48 string16* error) const { | |
| 49 for (DelegateList::const_iterator it = delegates_.begin(); | |
| 50 it != delegates_.end(); ++it) { | |
| 51 if (!(*it)->UserMayInstall(extension_id, location, extension_name, error)) | |
|
Aaron Boodman
2012/05/17 22:41:06
For debugging purposes, I suggest giving each poli
Aaron Boodman
2012/05/17 22:41:06
It seems like the providers will also be intereste
Pam (message me for reviews)
2012/05/18 20:15:15
Sure. To avoid spam, since these get called to che
Pam (message me for reviews)
2012/05/18 20:15:15
Yes, as long as we also pass the location, since C
| |
| 52 return false; | |
| 53 } | |
| 54 return true; | |
| 55 } | |
| 56 | |
| 57 bool ExtensionManagementPolicy::UserMayModifyStatus( | |
| 58 const Extension* extension, string16* error) const { | |
| 59 for (DelegateList::const_iterator it = delegates_.begin(); | |
| 60 it != delegates_.end(); ++it) { | |
| 61 if (!(*it)->UserMayModifyStatus(extension, error)) | |
| 62 return false; | |
| 63 } | |
| 64 return true; | |
| 65 } | |
| 66 | |
| 67 bool ExtensionManagementPolicy::UserMayModifyUsage( | |
| 68 const Extension* extension, string16* error) const { | |
| 69 for (DelegateList::const_iterator it = delegates_.begin(); | |
| 70 it != delegates_.end(); ++it) { | |
| 71 if (!(*it)->UserMayModifyUsage(extension, error)) | |
| 72 return false; | |
| 73 } | |
| 74 return true; | |
| 75 } | |
| 76 | |
| 77 bool ExtensionManagementPolicy::MustRemainEnabled( | |
| 78 const Extension* extension, string16* error) const { | |
| 79 for (DelegateList::const_iterator it = delegates_.begin(); | |
| 80 it != delegates_.end(); ++it) { | |
| 81 if ((*it)->MustRemainEnabled(extension, error)) | |
| 82 return true; | |
| 83 } | |
| 84 return false; | |
| 85 } | |
| 86 | |
| 87 void ExtensionManagementPolicy::UnregisterAllDelegates() { | |
| 88 delegates_.clear(); | |
| 89 } | |
| 90 | |
| 91 size_t ExtensionManagementPolicy::CountDelegates() { | |
| 92 return delegates_.size(); | |
| 93 } | |
| OLD | NEW |