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

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: fix for idleness waiting problem caused by crrev.com/388245 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 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 511
512 const extensions::PendingExtensionInfo* pending_extension_info = 512 const extensions::PendingExtensionInfo* pending_extension_info =
513 pending_extension_manager()->GetById(id); 513 pending_extension_manager()->GetById(id);
514 514
515 const Extension* extension = GetInstalledExtension(id); 515 const Extension* extension = GetInstalledExtension(id);
516 if (!pending_extension_info && !extension) { 516 if (!pending_extension_info && !extension) {
517 LOG(WARNING) << "Will not update extension " << id 517 LOG(WARNING) << "Will not update extension " << id
518 << " because it is not installed or pending"; 518 << " because it is not installed or pending";
519 // Delete extension_path since we're not creating a CrxInstaller 519 // Delete extension_path since we're not creating a CrxInstaller
520 // that would do it for us. 520 // that would do it for us.
521 if (!GetFileTaskRunner()->PostTask( 521 if (file_ownership_passed &&
522 !GetFileTaskRunner()->PostTask(
522 FROM_HERE, 523 FROM_HERE,
523 base::Bind(&extensions::file_util::DeleteFile, file.path, false))) 524 base::Bind(&extensions::file_util::DeleteFile, file.path, false)))
524 NOTREACHED(); 525 NOTREACHED();
525 526
526 return false; 527 return false;
527 } 528 }
528 529
529 scoped_refptr<CrxInstaller> installer(CrxInstaller::CreateSilent(this)); 530 scoped_refptr<CrxInstaller> installer(CrxInstaller::CreateSilent(this));
530 installer->set_expected_id(id); 531 installer->set_expected_id(id);
531 installer->set_expected_hash(file.expected_hash); 532 installer->set_expected_hash(file.expected_hash);
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 // the map, someone failed to update |unloaded_extension_paths_|. 685 // the map, someone failed to update |unloaded_extension_paths_|.
685 CHECK(!path.empty()); 686 CHECK(!path.empty());
686 scoped_refptr<extensions::UnpackedInstaller> unpacked_installer = 687 scoped_refptr<extensions::UnpackedInstaller> unpacked_installer =
687 extensions::UnpackedInstaller::Create(this); 688 extensions::UnpackedInstaller::Create(this);
688 unpacked_installer->set_be_noisy_on_failure(be_noisy); 689 unpacked_installer->set_be_noisy_on_failure(be_noisy);
689 unpacked_installer->Load(path); 690 unpacked_installer->Load(path);
690 } 691 }
691 } 692 }
692 693
693 void ExtensionService::ReloadExtension(const std::string& extension_id) { 694 void ExtensionService::ReloadExtension(const std::string& extension_id) {
694 ReloadExtensionImpl(extension_id, true); // be_noisy 695 ReloadExtensionImpl(extension_id, true); // be_noisy
695 } 696 }
696 697
697 void ExtensionService::ReloadExtensionWithQuietFailure( 698 void ExtensionService::ReloadExtensionWithQuietFailure(
698 const std::string& extension_id) { 699 const std::string& extension_id) {
699 ReloadExtensionImpl(extension_id, false); // be_noisy 700 ReloadExtensionImpl(extension_id, false); // be_noisy
700 } 701 }
701 702
702 bool ExtensionService::UninstallExtension( 703 bool ExtensionService::UninstallExtension(
703 // "transient" because the process of uninstalling may cause the reference 704 // "transient" because the process of uninstalling may cause the reference
704 // to become invalid. Instead, use |extenson->id()|. 705 // to become invalid. Instead, use |extenson->id()|.
705 const std::string& transient_extension_id, 706 const std::string& transient_extension_id,
706 extensions::UninstallReason reason, 707 extensions::UninstallReason reason,
707 const base::Closure& deletion_done_callback, 708 const base::Closure& deletion_done_callback,
708 base::string16* error) { 709 base::string16* error) {
709 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 710 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
(...skipping 1715 matching lines...) Expand 10 before | Expand all | Expand 10 after
2425 } 2426 }
2426 2427
2427 void ExtensionService::OnProfileDestructionStarted() { 2428 void ExtensionService::OnProfileDestructionStarted() {
2428 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); 2429 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs();
2429 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); 2430 for (ExtensionIdSet::iterator it = ids_to_unload.begin();
2430 it != ids_to_unload.end(); 2431 it != ids_to_unload.end();
2431 ++it) { 2432 ++it) {
2432 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); 2433 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN);
2433 } 2434 }
2434 } 2435 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698