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

Side by Side Diff: components/component_updater/default_component_installer.cc

Issue 2205693004: Rename and repurpose ComponentInstallerTraits::CanAutoUpdate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cus-gp
Patch Set: rebase Created 4 years, 4 months 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 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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
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) << __func__ << " 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 CrxComponent crx;
329 CrxComponent crx; 329 installer_traits_->GetHash(&crx.pk_hash);
330 installer_traits_->GetHash(&crx.pk_hash); 330 crx.installer = this;
331 crx.installer = this; 331 crx.version = current_version_;
332 crx.version = current_version_; 332 crx.fingerprint = current_fingerprint_;
333 crx.fingerprint = current_fingerprint_; 333 crx.name = installer_traits_->GetName();
334 crx.name = installer_traits_->GetName(); 334 crx.installer_attributes = installer_traits_->GetInstallerAttributes();
335 crx.installer_attributes = installer_traits_->GetInstallerAttributes(); 335 crx.requires_network_encryption =
336 crx.requires_network_encryption = 336 installer_traits_->RequiresNetworkEncryption();
337 installer_traits_->RequiresNetworkEncryption(); 337 crx.handled_mime_types = installer_traits_->GetMimeTypes();
338 crx.handled_mime_types = installer_traits_->GetMimeTypes(); 338 if (!cus->RegisterComponent(crx)) {
339 if (!cus->RegisterComponent(crx)) { 339 LOG(ERROR) << "Component registration failed for "
340 LOG(ERROR) << "Component registration failed for " 340 << installer_traits_->GetName();
341 << installer_traits_->GetName(); 341 return;
342 return; 342 }
343 }
344 343
345 if (!callback.is_null()) 344 if (!callback.is_null())
346 callback.Run(); 345 callback.Run();
347 }
348 346
349 if (!current_manifest_) { 347 if (!current_manifest_) {
350 DVLOG(1) << "No component found for " << installer_traits_->GetName(); 348 DVLOG(1) << "No component found for " << installer_traits_->GetName();
351 return; 349 return;
352 } 350 }
353 351
354 std::unique_ptr<base::DictionaryValue> manifest_copy( 352 std::unique_ptr<base::DictionaryValue> manifest_copy(
355 current_manifest_->DeepCopy()); 353 current_manifest_->DeepCopy());
356 ComponentReady(std::move(manifest_copy)); 354 ComponentReady(std::move(manifest_copy));
357 } 355 }
358 356
359 void DefaultComponentInstaller::ComponentReady( 357 void DefaultComponentInstaller::ComponentReady(
360 std::unique_ptr<base::DictionaryValue> manifest) { 358 std::unique_ptr<base::DictionaryValue> manifest) {
361 VLOG(1) << "Component ready, version " << current_version_.GetString() 359 VLOG(1) << "Component ready, version " << current_version_.GetString()
362 << " in " << current_install_dir_.value(); 360 << " in " << current_install_dir_.value();
363 installer_traits_->ComponentReady(current_version_, current_install_dir_, 361 installer_traits_->ComponentReady(current_version_, current_install_dir_,
364 std::move(manifest)); 362 std::move(manifest));
365 } 363 }
366 364
367 } // namespace component_updater 365 } // namespace component_updater
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698