Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Side by Side Diff: chrome/browser/component_updater/widevine_cdm_component_installer.cc

Issue 2479633003: Makes the component installers return a Result instead of a bool. (Closed)
Patch Set: rebase Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/widevine_cdm_component_installer.h" 5 #include "chrome/browser/component_updater/widevine_cdm_component_installer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <string.h> 9 #include <string.h>
10 #include <memory> 10 #include <memory>
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 243
244 class WidevineCdmComponentInstallerTraits : public ComponentInstallerTraits { 244 class WidevineCdmComponentInstallerTraits : public ComponentInstallerTraits {
245 public: 245 public:
246 WidevineCdmComponentInstallerTraits(); 246 WidevineCdmComponentInstallerTraits();
247 ~WidevineCdmComponentInstallerTraits() override {} 247 ~WidevineCdmComponentInstallerTraits() override {}
248 248
249 private: 249 private:
250 // The following methods override ComponentInstallerTraits. 250 // The following methods override ComponentInstallerTraits.
251 bool SupportsGroupPolicyEnabledComponentUpdates() const override; 251 bool SupportsGroupPolicyEnabledComponentUpdates() const override;
252 bool RequiresNetworkEncryption() const override; 252 bool RequiresNetworkEncryption() const override;
253 bool OnCustomInstall(const base::DictionaryValue& manifest, 253 update_client::CrxInstaller::Result OnCustomInstall(
254 const base::FilePath& install_dir) override; 254 const base::DictionaryValue& manifest,
255 const base::FilePath& install_dir) override;
255 bool VerifyInstallation( 256 bool VerifyInstallation(
256 const base::DictionaryValue& manifest, 257 const base::DictionaryValue& manifest,
257 const base::FilePath& install_dir) const override; 258 const base::FilePath& install_dir) const override;
258 void ComponentReady(const base::Version& version, 259 void ComponentReady(const base::Version& version,
259 const base::FilePath& path, 260 const base::FilePath& path,
260 std::unique_ptr<base::DictionaryValue> manifest) override; 261 std::unique_ptr<base::DictionaryValue> manifest) override;
261 base::FilePath GetRelativeInstallDir() const override; 262 base::FilePath GetRelativeInstallDir() const override;
262 void GetHash(std::vector<uint8_t>* hash) const override; 263 void GetHash(std::vector<uint8_t>* hash) const override;
263 std::string GetName() const override; 264 std::string GetName() const override;
264 update_client::InstallerAttributes GetInstallerAttributes() const override; 265 update_client::InstallerAttributes GetInstallerAttributes() const override;
(...skipping 16 matching lines...) Expand all
281 282
282 bool WidevineCdmComponentInstallerTraits:: 283 bool WidevineCdmComponentInstallerTraits::
283 SupportsGroupPolicyEnabledComponentUpdates() const { 284 SupportsGroupPolicyEnabledComponentUpdates() const {
284 return true; 285 return true;
285 } 286 }
286 287
287 bool WidevineCdmComponentInstallerTraits::RequiresNetworkEncryption() const { 288 bool WidevineCdmComponentInstallerTraits::RequiresNetworkEncryption() const {
288 return false; 289 return false;
289 } 290 }
290 291
291 bool WidevineCdmComponentInstallerTraits::OnCustomInstall( 292 update_client::CrxInstaller::Result
293 WidevineCdmComponentInstallerTraits::OnCustomInstall(
292 const base::DictionaryValue& manifest, 294 const base::DictionaryValue& manifest,
293 const base::FilePath& install_dir) { 295 const base::FilePath& install_dir) {
294 return true; 296 return update_client::CrxInstaller::Result(0);
295 } 297 }
296 298
297 // Once the CDM is ready, check the CDM adapter. 299 // Once the CDM is ready, check the CDM adapter.
298 void WidevineCdmComponentInstallerTraits::ComponentReady( 300 void WidevineCdmComponentInstallerTraits::ComponentReady(
299 const base::Version& version, 301 const base::Version& version,
300 const base::FilePath& path, 302 const base::FilePath& path,
301 std::unique_ptr<base::DictionaryValue> manifest) { 303 std::unique_ptr<base::DictionaryValue> manifest) {
302 if (!IsCompatibleWithChrome(*manifest)) { 304 if (!IsCompatibleWithChrome(*manifest)) {
303 VLOG(1) << "Installed Widevine CDM component is incompatible."; 305 VLOG(1) << "Installed Widevine CDM component is incompatible.";
304 return; 306 return;
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 std::unique_ptr<ComponentInstallerTraits> traits( 416 std::unique_ptr<ComponentInstallerTraits> traits(
415 new WidevineCdmComponentInstallerTraits); 417 new WidevineCdmComponentInstallerTraits);
416 // |cus| will take ownership of |installer| during installer->Register(cus). 418 // |cus| will take ownership of |installer| during installer->Register(cus).
417 DefaultComponentInstaller* installer = 419 DefaultComponentInstaller* installer =
418 new DefaultComponentInstaller(std::move(traits)); 420 new DefaultComponentInstaller(std::move(traits));
419 installer->Register(cus, base::Closure()); 421 installer->Register(cus, base::Closure());
420 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) 422 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT)
421 } 423 }
422 424
423 } // namespace component_updater 425 } // namespace component_updater
OLDNEW
« no previous file with comments | « chrome/browser/component_updater/swiftshader_component_installer.cc ('k') | chrome/browser/net/crl_set_fetcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698