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

Side by Side Diff: chrome/browser/extensions/extension_service.cc

Issue 1887253002: Rate limit programmatic update checks for extensions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 (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/extensions/extension_service.h" 5 #include "chrome/browser/extensions/extension_service.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <iterator> 10 #include <iterator>
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 512
513 const extensions::PendingExtensionInfo* pending_extension_info = 513 const extensions::PendingExtensionInfo* pending_extension_info =
514 pending_extension_manager()->GetById(id); 514 pending_extension_manager()->GetById(id);
515 515
516 const Extension* extension = GetInstalledExtension(id); 516 const Extension* extension = GetInstalledExtension(id);
517 if (!pending_extension_info && !extension) { 517 if (!pending_extension_info && !extension) {
518 LOG(WARNING) << "Will not update extension " << id 518 LOG(WARNING) << "Will not update extension " << id
519 << " because it is not installed or pending"; 519 << " because it is not installed or pending";
520 // Delete extension_path since we're not creating a CrxInstaller 520 // Delete extension_path since we're not creating a CrxInstaller
521 // that would do it for us. 521 // that would do it for us.
522 if (!GetFileTaskRunner()->PostTask( 522 if (file_ownership_passed &&
523 !GetFileTaskRunner()->PostTask(
523 FROM_HERE, 524 FROM_HERE,
524 base::Bind(&extensions::file_util::DeleteFile, file.path, false))) 525 base::Bind(&extensions::file_util::DeleteFile, file.path, false)))
525 NOTREACHED(); 526 NOTREACHED();
526 527
527 return false; 528 return false;
528 } 529 }
529 530
530 scoped_refptr<CrxInstaller> installer(CrxInstaller::CreateSilent(this)); 531 scoped_refptr<CrxInstaller> installer(CrxInstaller::CreateSilent(this));
531 installer->set_expected_id(id); 532 installer->set_expected_id(id);
532 installer->set_expected_hash(file.expected_hash); 533 installer->set_expected_hash(file.expected_hash);
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 // the map, someone failed to update |unloaded_extension_paths_|. 686 // the map, someone failed to update |unloaded_extension_paths_|.
686 CHECK(!path.empty()); 687 CHECK(!path.empty());
687 scoped_refptr<extensions::UnpackedInstaller> unpacked_installer = 688 scoped_refptr<extensions::UnpackedInstaller> unpacked_installer =
688 extensions::UnpackedInstaller::Create(this); 689 extensions::UnpackedInstaller::Create(this);
689 unpacked_installer->set_be_noisy_on_failure(be_noisy); 690 unpacked_installer->set_be_noisy_on_failure(be_noisy);
690 unpacked_installer->Load(path); 691 unpacked_installer->Load(path);
691 } 692 }
692 } 693 }
693 694
694 void ExtensionService::ReloadExtension(const std::string& extension_id) { 695 void ExtensionService::ReloadExtension(const std::string& extension_id) {
695 ReloadExtensionImpl(extension_id, true); // be_noisy 696 ReloadExtensionImpl(extension_id, true); // be_noisy
696 } 697 }
697 698
698 void ExtensionService::ReloadExtensionWithQuietFailure( 699 void ExtensionService::ReloadExtensionWithQuietFailure(
699 const std::string& extension_id) { 700 const std::string& extension_id) {
700 ReloadExtensionImpl(extension_id, false); // be_noisy 701 ReloadExtensionImpl(extension_id, false); // be_noisy
701 } 702 }
702 703
703 bool ExtensionService::UninstallExtension( 704 bool ExtensionService::UninstallExtension(
704 // "transient" because the process of uninstalling may cause the reference 705 // "transient" because the process of uninstalling may cause the reference
705 // to become invalid. Instead, use |extenson->id()|. 706 // to become invalid. Instead, use |extenson->id()|.
706 const std::string& transient_extension_id, 707 const std::string& transient_extension_id,
707 extensions::UninstallReason reason, 708 extensions::UninstallReason reason,
708 const base::Closure& deletion_done_callback, 709 const base::Closure& deletion_done_callback,
709 base::string16* error) { 710 base::string16* error) {
710 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 711 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
(...skipping 1740 matching lines...) Expand 10 before | Expand all | Expand 10 after
2451 } 2452 }
2452 2453
2453 void ExtensionService::OnProfileDestructionStarted() { 2454 void ExtensionService::OnProfileDestructionStarted() {
2454 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); 2455 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs();
2455 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); 2456 for (ExtensionIdSet::iterator it = ids_to_unload.begin();
2456 it != ids_to_unload.end(); 2457 it != ids_to_unload.end();
2457 ++it) { 2458 ++it) {
2458 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); 2459 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN);
2459 } 2460 }
2460 } 2461 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698