| OLD | NEW |
| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <iterator> | 8 #include <iterator> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 } | 607 } |
| 608 | 608 |
| 609 void ExtensionService::MaybeBootstrapVerifier() { | 609 void ExtensionService::MaybeBootstrapVerifier() { |
| 610 InstallVerifier* verifier = | 610 InstallVerifier* verifier = |
| 611 extensions::ExtensionSystem::Get(profile_)->install_verifier(); | 611 extensions::ExtensionSystem::Get(profile_)->install_verifier(); |
| 612 bool do_bootstrap = false; | 612 bool do_bootstrap = false; |
| 613 | 613 |
| 614 if (verifier->NeedsBootstrap()) { | 614 if (verifier->NeedsBootstrap()) { |
| 615 do_bootstrap = true; | 615 do_bootstrap = true; |
| 616 } else { | 616 } else { |
| 617 // If any of the installed extensions have an install time newer than the | |
| 618 // signature's timestamp, we need to bootstrap because our signature may | |
| 619 // be missing valid extensions. | |
| 620 base::Time timestamp = verifier->SignatureTimestamp(); | |
| 621 scoped_ptr<extensions::ExtensionSet> extensions = | 617 scoped_ptr<extensions::ExtensionSet> extensions = |
| 622 GenerateInstalledExtensionsSet(); | 618 GenerateInstalledExtensionsSet(); |
| 623 for (extensions::ExtensionSet::const_iterator i = extensions->begin(); | 619 for (extensions::ExtensionSet::const_iterator i = extensions->begin(); |
| 624 i != extensions->end(); | 620 i != extensions->end(); |
| 625 ++i) { | 621 ++i) { |
| 626 const Extension& extension = **i; | 622 const Extension& extension = **i; |
| 627 base::Time install_time = | 623 |
| 628 extension_prefs_->GetInstallTime(extension.id()); | |
| 629 if (verifier->NeedsVerification(extension) && | 624 if (verifier->NeedsVerification(extension) && |
| 630 install_time < base::Time::Now() && install_time >= timestamp) { | 625 !verifier->IsKnownId(extension.id())) { |
| 631 do_bootstrap = true; | 626 do_bootstrap = true; |
| 632 break; | 627 break; |
| 633 } | 628 } |
| 634 } | 629 } |
| 635 } | 630 } |
| 636 if (do_bootstrap) | 631 if (do_bootstrap) |
| 637 VerifyAllExtensions(true); // bootstrap=true. | 632 VerifyAllExtensions(true); // bootstrap=true. |
| 638 } | 633 } |
| 639 | 634 |
| 640 void ExtensionService::VerifyAllExtensions(bool bootstrap) { | 635 void ExtensionService::VerifyAllExtensions(bool bootstrap) { |
| (...skipping 2251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2892 void ExtensionService::UnloadAllExtensionsInternal() { | 2887 void ExtensionService::UnloadAllExtensionsInternal() { |
| 2893 profile_->GetExtensionSpecialStoragePolicy()->RevokeRightsForAllExtensions(); | 2888 profile_->GetExtensionSpecialStoragePolicy()->RevokeRightsForAllExtensions(); |
| 2894 | 2889 |
| 2895 registry_->ClearAll(); | 2890 registry_->ClearAll(); |
| 2896 system_->runtime_data()->ClearAll(); | 2891 system_->runtime_data()->ClearAll(); |
| 2897 | 2892 |
| 2898 // TODO(erikkay) should there be a notification for this? We can't use | 2893 // TODO(erikkay) should there be a notification for this? We can't use |
| 2899 // EXTENSION_UNLOADED since that implies that the extension has been disabled | 2894 // EXTENSION_UNLOADED since that implies that the extension has been disabled |
| 2900 // or uninstalled. | 2895 // or uninstalled. |
| 2901 } | 2896 } |
| OLD | NEW |