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

Unified Diff: chrome/browser/extensions/extension_service.cc

Issue 93513006: Allow re-enabling of DISABLE_NOT_VERIFIED extensions if appropriate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix a few nits Created 7 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/extensions/extension_service.h ('k') | chrome/browser/extensions/install_verifier.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_service.cc
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index 3da62e6129189f5b1a1854ab7b17bf5b6dc8c73b..9c61f40510bdd65a269dee567421a4b17da9754f 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -573,6 +573,11 @@ void ExtensionService::Init() {
// rather than running immediately at startup.
CheckForExternalUpdates();
+ InstallVerifier* verifier =
+ extensions::ExtensionSystem::Get(profile_)->install_verifier();
+ if (verifier->NeedsBootstrap())
+ VerifyAllExtensions();
+
base::MessageLoop::current()->PostDelayedTask(
FROM_HERE,
base::Bind(&ExtensionService::GarbageCollectExtensions, AsWeakPtr()),
@@ -590,6 +595,55 @@ void ExtensionService::Init() {
base::Time::Now() - begin_time);
}
+void ExtensionService::VerifyAllExtensions() {
+ ExtensionIdSet to_add;
+ scoped_ptr<ExtensionSet> all_extensions = GenerateInstalledExtensionsSet();
+
+ for (ExtensionSet::const_iterator i = all_extensions->begin();
+ i != all_extensions->end(); ++i) {
+ const Extension& extension = **i;
+
+ if (extensions::ManifestURL::UpdatesFromGallery(&extension) &&
+ extension.is_extension())
+ to_add.insert(extension.id());
+ }
+ extensions::ExtensionSystem::Get(profile_)->install_verifier()->AddMany(
+ to_add, base::Bind(&ExtensionService::FinishVerifyAllExtensions,
+ AsWeakPtr()));
+}
+
+void ExtensionService::FinishVerifyAllExtensions(bool success) {
+ if (success) {
+ // Check to see if any currently unverified extensions became verified.
+ InstallVerifier* verifier =
+ extensions::ExtensionSystem::Get(profile_)->install_verifier();
+ for (ExtensionSet::const_iterator i = disabled_extensions_.begin();
+ i != disabled_extensions_.end(); ++i) {
+ const Extension& extension = **i;
+ int disable_reasons = extension_prefs_->GetDisableReasons(extension.id());
+ if (disable_reasons & Extension::DISABLE_NOT_VERIFIED &&
+ !verifier->MustRemainDisabled(&extension, NULL, NULL)) {
+ extension_prefs_->RemoveDisableReason(extension.id(),
+ Extension::DISABLE_NOT_VERIFIED);
+ // Notify interested observers (eg the extensions settings page) by
+ // sending an UNLOADED notification.
+ //
+ // TODO(asargent) - this is a slight hack because it's already
+ // disabled; the right solution might be to add a separate listener
+ // interface for DisableReason's changing. http://crbug.com/328916
+ UnloadedExtensionInfo details(&extension,
+ UnloadedExtensionInfo::REASON_DISABLE);
+ content::NotificationService::current()->Notify(
+ chrome::NOTIFICATION_EXTENSION_UNLOADED,
+ content::Source<Profile>(profile_),
+ content::Details<UnloadedExtensionInfo>(&details));
+ }
+ }
+ // Might disable some extensions.
+ CheckManagementPolicy();
+ }
+}
+
bool ExtensionService::UpdateExtension(const std::string& id,
const base::FilePath& extension_path,
const GURL& download_url,
« no previous file with comments | « chrome/browser/extensions/extension_service.h ('k') | chrome/browser/extensions/install_verifier.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698