| 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 "components/component_updater/default_component_installer.h" | 5 #include "components/component_updater/default_component_installer.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 } | 314 } |
| 315 | 315 |
| 316 void DefaultComponentInstaller::FinishRegistration( | 316 void DefaultComponentInstaller::FinishRegistration( |
| 317 ComponentUpdateService* cus, | 317 ComponentUpdateService* cus, |
| 318 const base::Closure& callback) { | 318 const base::Closure& callback) { |
| 319 VLOG(1) << __FUNCTION__ << " for " << installer_traits_->GetName(); | 319 VLOG(1) << __FUNCTION__ << " for " << installer_traits_->GetName(); |
| 320 DCHECK(thread_checker_.CalledOnValidThread()); | 320 DCHECK(thread_checker_.CalledOnValidThread()); |
| 321 | 321 |
| 322 if (installer_traits_->CanAutoUpdate()) { | 322 if (installer_traits_->CanAutoUpdate()) { |
| 323 CrxComponent crx; | 323 CrxComponent crx; |
| 324 crx.name = installer_traits_->GetName(); | 324 installer_traits_->GetHash(&crx.pk_hash); |
| 325 crx.requires_network_encryption = | |
| 326 installer_traits_->RequiresNetworkEncryption(); | |
| 327 crx.installer = this; | 325 crx.installer = this; |
| 328 crx.version = current_version_; | 326 crx.version = current_version_; |
| 329 crx.fingerprint = current_fingerprint_; | 327 crx.fingerprint = current_fingerprint_; |
| 330 installer_traits_->GetHash(&crx.pk_hash); | 328 crx.name = installer_traits_->GetName(); |
| 329 crx.ap = installer_traits_->GetAp(); |
| 330 crx.requires_network_encryption = |
| 331 installer_traits_->RequiresNetworkEncryption(); |
| 331 if (!cus->RegisterComponent(crx)) { | 332 if (!cus->RegisterComponent(crx)) { |
| 332 LOG(ERROR) << "Component registration failed for " | 333 LOG(ERROR) << "Component registration failed for " |
| 333 << installer_traits_->GetName(); | 334 << installer_traits_->GetName(); |
| 334 return; | 335 return; |
| 335 } | 336 } |
| 336 | 337 |
| 337 if (!callback.is_null()) | 338 if (!callback.is_null()) |
| 338 callback.Run(); | 339 callback.Run(); |
| 339 } | 340 } |
| 340 | 341 |
| 341 if (!current_manifest_) { | 342 if (!current_manifest_) { |
| 342 DVLOG(1) << "No component found for " << installer_traits_->GetName(); | 343 DVLOG(1) << "No component found for " << installer_traits_->GetName(); |
| 343 return; | 344 return; |
| 344 } | 345 } |
| 345 | 346 |
| 346 std::unique_ptr<base::DictionaryValue> manifest_copy( | 347 std::unique_ptr<base::DictionaryValue> manifest_copy( |
| 347 current_manifest_->DeepCopy()); | 348 current_manifest_->DeepCopy()); |
| 348 ComponentReady(std::move(manifest_copy)); | 349 ComponentReady(std::move(manifest_copy)); |
| 349 } | 350 } |
| 350 | 351 |
| 351 void DefaultComponentInstaller::ComponentReady( | 352 void DefaultComponentInstaller::ComponentReady( |
| 352 std::unique_ptr<base::DictionaryValue> manifest) { | 353 std::unique_ptr<base::DictionaryValue> manifest) { |
| 353 VLOG(1) << "Component ready, version " << current_version_.GetString() | 354 VLOG(1) << "Component ready, version " << current_version_.GetString() |
| 354 << " in " << current_install_dir_.value(); | 355 << " in " << current_install_dir_.value(); |
| 355 installer_traits_->ComponentReady(current_version_, current_install_dir_, | 356 installer_traits_->ComponentReady(current_version_, current_install_dir_, |
| 356 std::move(manifest)); | 357 std::move(manifest)); |
| 357 } | 358 } |
| 358 | 359 |
| 359 } // namespace component_updater | 360 } // namespace component_updater |
| OLD | NEW |