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

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: updated to auto-recheck on settings page load when appropriate 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
Index: chrome/browser/extensions/extension_service.cc
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index 19d720f5a3014347f075818a9ef8ea70f4f85926..f6e9acf9762d7a8d166de67797b43bbcba2e5a3d 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -568,6 +568,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()),
@@ -585,6 +590,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.
Finnur 2013/12/16 14:21:51 Log a bug for this?
asargent_no_longer_on_chrome 2013/12/16 18:47:10 Done.
+ 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,

Powered by Google App Engine
This is Rietveld 408576698