| 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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 << " at " << path.MaybeAsASCII() << " with version " << version | 188 << " at " << path.MaybeAsASCII() << " with version " << version |
| 189 << "."; | 189 << "."; |
| 190 | 190 |
| 191 current_install_dir_ = path; | 191 current_install_dir_ = path; |
| 192 current_manifest_ = std::move(manifest); | 192 current_manifest_ = std::move(manifest); |
| 193 current_version_ = version; | 193 current_version_ = version; |
| 194 return true; | 194 return true; |
| 195 } | 195 } |
| 196 | 196 |
| 197 void DefaultComponentInstaller::StartRegistration(ComponentUpdateService* cus) { | 197 void DefaultComponentInstaller::StartRegistration(ComponentUpdateService* cus) { |
| 198 VLOG(1) << __FUNCTION__ << " for " << installer_traits_->GetName(); | 198 VLOG(1) << __func__ << " for " << installer_traits_->GetName(); |
| 199 DCHECK(task_runner_.get()); | 199 DCHECK(task_runner_.get()); |
| 200 DCHECK(task_runner_->RunsTasksOnCurrentThread()); | 200 DCHECK(task_runner_->RunsTasksOnCurrentThread()); |
| 201 | 201 |
| 202 base::Version latest_version(kNullVersion); | 202 base::Version latest_version(kNullVersion); |
| 203 | 203 |
| 204 // First check for an installation set up alongside Chrome itself. | 204 // First check for an installation set up alongside Chrome itself. |
| 205 base::FilePath root; | 205 base::FilePath root; |
| 206 if (PathService::Get(DIR_COMPONENT_PREINSTALLED, &root) && | 206 if (PathService::Get(DIR_COMPONENT_PREINSTALLED, &root) && |
| 207 FindPreinstallation(root)) { | 207 FindPreinstallation(root)) { |
| 208 latest_version = current_version_; | 208 latest_version = current_version_; |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 // Delete the base directory if it's empty now. | 315 // Delete the base directory if it's empty now. |
| 316 if (base::IsDirectoryEmpty(base_dir)) { | 316 if (base::IsDirectoryEmpty(base_dir)) { |
| 317 if (base::DeleteFile(base_dir, false)) | 317 if (base::DeleteFile(base_dir, false)) |
| 318 DLOG(ERROR) << "Couldn't delete " << base_dir.value(); | 318 DLOG(ERROR) << "Couldn't delete " << base_dir.value(); |
| 319 } | 319 } |
| 320 } | 320 } |
| 321 | 321 |
| 322 void DefaultComponentInstaller::FinishRegistration( | 322 void DefaultComponentInstaller::FinishRegistration( |
| 323 ComponentUpdateService* cus, | 323 ComponentUpdateService* cus, |
| 324 const base::Closure& callback) { | 324 const base::Closure& callback) { |
| 325 VLOG(1) << __FUNCTION__ << " for " << installer_traits_->GetName(); | 325 VLOG(1) << __func__ << " for " << installer_traits_->GetName(); |
| 326 DCHECK(thread_checker_.CalledOnValidThread()); | 326 DCHECK(thread_checker_.CalledOnValidThread()); |
| 327 | 327 |
| 328 if (installer_traits_->CanAutoUpdate()) { | 328 if (installer_traits_->CanAutoUpdate()) { |
| 329 CrxComponent crx; | 329 CrxComponent crx; |
| 330 installer_traits_->GetHash(&crx.pk_hash); | 330 installer_traits_->GetHash(&crx.pk_hash); |
| 331 crx.installer = this; | 331 crx.installer = this; |
| 332 crx.version = current_version_; | 332 crx.version = current_version_; |
| 333 crx.fingerprint = current_fingerprint_; | 333 crx.fingerprint = current_fingerprint_; |
| 334 crx.name = installer_traits_->GetName(); | 334 crx.name = installer_traits_->GetName(); |
| 335 crx.installer_attributes = installer_traits_->GetInstallerAttributes(); | 335 crx.installer_attributes = installer_traits_->GetInstallerAttributes(); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 357 | 357 |
| 358 void DefaultComponentInstaller::ComponentReady( | 358 void DefaultComponentInstaller::ComponentReady( |
| 359 std::unique_ptr<base::DictionaryValue> manifest) { | 359 std::unique_ptr<base::DictionaryValue> manifest) { |
| 360 VLOG(1) << "Component ready, version " << current_version_.GetString() | 360 VLOG(1) << "Component ready, version " << current_version_.GetString() |
| 361 << " in " << current_install_dir_.value(); | 361 << " in " << current_install_dir_.value(); |
| 362 installer_traits_->ComponentReady(current_version_, current_install_dir_, | 362 installer_traits_->ComponentReady(current_version_, current_install_dir_, |
| 363 std::move(manifest)); | 363 std::move(manifest)); |
| 364 } | 364 } |
| 365 | 365 |
| 366 } // namespace component_updater | 366 } // namespace component_updater |
| OLD | NEW |