Index: chrome/browser/component_updater/supervised_user_whitelist_installer.cc |
diff --git a/chrome/browser/component_updater/supervised_user_whitelist_installer.cc b/chrome/browser/component_updater/supervised_user_whitelist_installer.cc |
index 603242f0850450ef3364e8a9d173dced52040bbc..b2cfb1cf09641e20a2fa8dc515ec2d935e46cf63 100644 |
--- a/chrome/browser/component_updater/supervised_user_whitelist_installer.cc |
+++ b/chrome/browser/component_updater/supervised_user_whitelist_installer.cc |
@@ -121,9 +121,10 @@ class SupervisedUserWhitelistInstallerImpl |
const std::string& name, |
bool newly_added, |
const WhitelistReadyCallback& callback) override; |
- void UnregisterWhitelist(const std::string& crx_id) override; |
+ void UninstallWhitelist(const std::string& crx_id) override; |
ComponentUpdateService* cus_; |
+ std::map<std::string, scoped_refptr<DefaultComponentInstaller>> installers_; |
}; |
SupervisedUserWhitelistInstallerImpl::SupervisedUserWhitelistInstallerImpl( |
@@ -139,20 +140,22 @@ void SupervisedUserWhitelistInstallerImpl::RegisterWhitelist( |
scoped_ptr<ComponentInstallerTraits> traits( |
new SupervisedUserWhitelistComponentInstallerTraits(crx_id, name, |
callback)); |
- DefaultComponentInstaller* installer = |
- new DefaultComponentInstaller(traits.Pass()); |
+ scoped_refptr<DefaultComponentInstaller> installer( |
+ new DefaultComponentInstaller(traits.Pass())); |
- // Takes ownership of |installer|. |
installer->Register(cus_); |
+ installers_[crx_id] = installer; |
+ |
if (newly_added) |
TriggerComponentUpdate(&cus_->GetOnDemandUpdater(), crx_id); |
} |
-void SupervisedUserWhitelistInstallerImpl::UnregisterWhitelist( |
- const std::string& id) { |
- // TODO(bauerb): Implement! |
- NOTIMPLEMENTED(); |
+void SupervisedUserWhitelistInstallerImpl::UninstallWhitelist( |
+ const std::string& crx_id) { |
+ auto it = installers_.find(crx_id); |
Marc Treib
2015/02/04 09:55:46
nit: DCHECK_NE(it, installers_.end()) ?
Bernhard Bauer
2015/02/04 11:28:40
Done. Not using DCHECK_NE, because AFAICR that did
|
+ it->second->Unregister(cus_); |
+ installers_.erase(it); |
} |
} // namespace |