| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/component_updater/supervised_user_whitelist_installer.h
" | 5 #include "chrome/browser/component_updater/supervised_user_whitelist_installer.h
" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 public: | 114 public: |
| 115 explicit SupervisedUserWhitelistInstallerImpl(ComponentUpdateService* cus); | 115 explicit SupervisedUserWhitelistInstallerImpl(ComponentUpdateService* cus); |
| 116 ~SupervisedUserWhitelistInstallerImpl() override {} | 116 ~SupervisedUserWhitelistInstallerImpl() override {} |
| 117 | 117 |
| 118 private: | 118 private: |
| 119 // SupervisedUserWhitelistInstaller overrides: | 119 // SupervisedUserWhitelistInstaller overrides: |
| 120 void RegisterWhitelist(const std::string& crx_id, | 120 void RegisterWhitelist(const std::string& crx_id, |
| 121 const std::string& name, | 121 const std::string& name, |
| 122 bool newly_added, | 122 bool newly_added, |
| 123 const WhitelistReadyCallback& callback) override; | 123 const WhitelistReadyCallback& callback) override; |
| 124 void UnregisterWhitelist(const std::string& crx_id) override; | 124 void UninstallWhitelist(const std::string& crx_id) override; |
| 125 | 125 |
| 126 ComponentUpdateService* cus_; | 126 ComponentUpdateService* cus_; |
| 127 }; | 127 }; |
| 128 | 128 |
| 129 SupervisedUserWhitelistInstallerImpl::SupervisedUserWhitelistInstallerImpl( | 129 SupervisedUserWhitelistInstallerImpl::SupervisedUserWhitelistInstallerImpl( |
| 130 ComponentUpdateService* cus) | 130 ComponentUpdateService* cus) |
| 131 : cus_(cus) { | 131 : cus_(cus) { |
| 132 } | 132 } |
| 133 | 133 |
| 134 void SupervisedUserWhitelistInstallerImpl::RegisterWhitelist( | 134 void SupervisedUserWhitelistInstallerImpl::RegisterWhitelist( |
| 135 const std::string& crx_id, | 135 const std::string& crx_id, |
| 136 const std::string& name, | 136 const std::string& name, |
| 137 bool newly_added, | 137 bool newly_added, |
| 138 const WhitelistReadyCallback& callback) { | 138 const WhitelistReadyCallback& callback) { |
| 139 scoped_ptr<ComponentInstallerTraits> traits( | 139 scoped_ptr<ComponentInstallerTraits> traits( |
| 140 new SupervisedUserWhitelistComponentInstallerTraits(crx_id, name, | 140 new SupervisedUserWhitelistComponentInstallerTraits(crx_id, name, |
| 141 callback)); | 141 callback)); |
| 142 scoped_refptr<DefaultComponentInstaller> installer( | 142 scoped_refptr<DefaultComponentInstaller> installer( |
| 143 new DefaultComponentInstaller(traits.Pass())); | 143 new DefaultComponentInstaller(traits.Pass())); |
| 144 | |
| 145 installer->Register(cus_); | 144 installer->Register(cus_); |
| 146 | 145 |
| 147 if (newly_added) | 146 if (newly_added) |
| 148 TriggerComponentUpdate(&cus_->GetOnDemandUpdater(), crx_id); | 147 TriggerComponentUpdate(&cus_->GetOnDemandUpdater(), crx_id); |
| 149 } | 148 } |
| 150 | 149 |
| 151 void SupervisedUserWhitelistInstallerImpl::UnregisterWhitelist( | 150 void SupervisedUserWhitelistInstallerImpl::UninstallWhitelist( |
| 152 const std::string& id) { | 151 const std::string& crx_id) { |
| 153 // TODO(bauerb): Implement! | 152 const ComponentUpdateService::Status status = |
| 154 NOTIMPLEMENTED(); | 153 cus_->UnregisterComponent(crx_id); |
| 154 DCHECK_EQ(ComponentUpdateService::kOk, status); |
| 155 } | 155 } |
| 156 | 156 |
| 157 } // namespace | 157 } // namespace |
| 158 | 158 |
| 159 // static | 159 // static |
| 160 scoped_ptr<SupervisedUserWhitelistInstaller> | 160 scoped_ptr<SupervisedUserWhitelistInstaller> |
| 161 SupervisedUserWhitelistInstaller::Create(ComponentUpdateService* cus) { | 161 SupervisedUserWhitelistInstaller::Create(ComponentUpdateService* cus) { |
| 162 return make_scoped_ptr(new SupervisedUserWhitelistInstallerImpl(cus)); | 162 return make_scoped_ptr(new SupervisedUserWhitelistInstallerImpl(cus)); |
| 163 } | 163 } |
| 164 | 164 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 185 } | 185 } |
| 186 | 186 |
| 187 // static | 187 // static |
| 188 void SupervisedUserWhitelistInstaller::TriggerComponentUpdate( | 188 void SupervisedUserWhitelistInstaller::TriggerComponentUpdate( |
| 189 OnDemandUpdater* updater, | 189 OnDemandUpdater* updater, |
| 190 const std::string& crx_id) { | 190 const std::string& crx_id) { |
| 191 updater->OnDemandUpdate(crx_id); | 191 updater->OnDemandUpdate(crx_id); |
| 192 } | 192 } |
| 193 | 193 |
| 194 } // namespace component_updater | 194 } // namespace component_updater |
| OLD | NEW |