| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 // ComponentInstallerTraits overrides: | 250 // ComponentInstallerTraits overrides: |
| 251 bool VerifyInstallation(const base::DictionaryValue& manifest, | 251 bool VerifyInstallation(const base::DictionaryValue& manifest, |
| 252 const base::FilePath& install_dir) const override; | 252 const base::FilePath& install_dir) const override; |
| 253 bool CanAutoUpdate() const override; | 253 bool CanAutoUpdate() const override; |
| 254 bool RequiresNetworkEncryption() const override; | 254 bool RequiresNetworkEncryption() const override; |
| 255 bool OnCustomInstall(const base::DictionaryValue& manifest, | 255 bool OnCustomInstall(const base::DictionaryValue& manifest, |
| 256 const base::FilePath& install_dir) override; | 256 const base::FilePath& install_dir) override; |
| 257 void ComponentReady(const base::Version& version, | 257 void ComponentReady(const base::Version& version, |
| 258 const base::FilePath& install_dir, | 258 const base::FilePath& install_dir, |
| 259 std::unique_ptr<base::DictionaryValue> manifest) override; | 259 std::unique_ptr<base::DictionaryValue> manifest) override; |
| 260 base::FilePath GetBaseDirectory() const override; | 260 base::FilePath GetRelativeInstallDir() const override; |
| 261 void GetHash(std::vector<uint8_t>* hash) const override; | 261 void GetHash(std::vector<uint8_t>* hash) const override; |
| 262 std::string GetName() const override; | 262 std::string GetName() const override; |
| 263 std::string GetAp() const override; | 263 std::string GetAp() const override; |
| 264 | 264 |
| 265 std::string crx_id_; | 265 std::string crx_id_; |
| 266 std::string name_; | 266 std::string name_; |
| 267 RawWhitelistReadyCallback callback_; | 267 RawWhitelistReadyCallback callback_; |
| 268 | 268 |
| 269 DISALLOW_COPY_AND_ASSIGN(SupervisedUserWhitelistComponentInstallerTraits); | 269 DISALLOW_COPY_AND_ASSIGN(SupervisedUserWhitelistComponentInstallerTraits); |
| 270 }; | 270 }; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 299 std::unique_ptr<base::DictionaryValue> manifest) { | 299 std::unique_ptr<base::DictionaryValue> manifest) { |
| 300 // TODO(treib): Before getting the title, we should localize the manifest | 300 // TODO(treib): Before getting the title, we should localize the manifest |
| 301 // using extension_l10n_util::LocalizeExtension, but that doesn't exist on | 301 // using extension_l10n_util::LocalizeExtension, but that doesn't exist on |
| 302 // Android. crbug.com/558387 | 302 // Android. crbug.com/558387 |
| 303 callback_.Run(GetWhitelistTitle(*manifest), | 303 callback_.Run(GetWhitelistTitle(*manifest), |
| 304 GetLargeIconPath(*manifest, install_dir), | 304 GetLargeIconPath(*manifest, install_dir), |
| 305 GetRawWhitelistPath(*manifest, install_dir)); | 305 GetRawWhitelistPath(*manifest, install_dir)); |
| 306 } | 306 } |
| 307 | 307 |
| 308 base::FilePath | 308 base::FilePath |
| 309 SupervisedUserWhitelistComponentInstallerTraits::GetBaseDirectory() const { | 309 SupervisedUserWhitelistComponentInstallerTraits::GetRelativeInstallDir() const { |
| 310 base::FilePath whitelist_directory; | 310 return base::FilePath(component_updater::kSupervisedUserWhitelistDirName) |
| 311 PathService::Get(DIR_SUPERVISED_USER_WHITELISTS, &whitelist_directory); | 311 .AppendASCII(crx_id_); |
| 312 return whitelist_directory.AppendASCII(crx_id_); | |
| 313 } | 312 } |
| 314 | 313 |
| 315 void SupervisedUserWhitelistComponentInstallerTraits::GetHash( | 314 void SupervisedUserWhitelistComponentInstallerTraits::GetHash( |
| 316 std::vector<uint8_t>* hash) const { | 315 std::vector<uint8_t>* hash) const { |
| 317 *hash = SupervisedUserWhitelistInstaller::GetHashFromCrxId(crx_id_); | 316 *hash = SupervisedUserWhitelistInstaller::GetHashFromCrxId(crx_id_); |
| 318 } | 317 } |
| 319 | 318 |
| 320 std::string SupervisedUserWhitelistComponentInstallerTraits::GetName() const { | 319 std::string SupervisedUserWhitelistComponentInstallerTraits::GetName() const { |
| 321 return name_; | 320 return name_; |
| 322 } | 321 } |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 | 631 |
| 633 // static | 632 // static |
| 634 void SupervisedUserWhitelistInstaller::TriggerComponentUpdate( | 633 void SupervisedUserWhitelistInstaller::TriggerComponentUpdate( |
| 635 OnDemandUpdater* updater, | 634 OnDemandUpdater* updater, |
| 636 const std::string& crx_id) { | 635 const std::string& crx_id) { |
| 637 const bool result = updater->OnDemandUpdate(crx_id); | 636 const bool result = updater->OnDemandUpdate(crx_id); |
| 638 DCHECK(result); | 637 DCHECK(result); |
| 639 } | 638 } |
| 640 | 639 |
| 641 } // namespace component_updater | 640 } // namespace component_updater |
| OLD | NEW |