Enable Zip Unpacker extension when it were disabled.
Component extension cannot be disabled or uninstalled by any user
operations, but we got some cases where Zip Unpacker was disabled
in some user's profile.
Bug: 643060
Test: unit_tests --gtest_filter=ExtensionServiceTest.*
Change-Id: Id27ca4472270d37175dd21b54f070c37b2c6f282
Reviewed-on: https://chromium-review.googlesource.com/737892
Reviewed-by: Finnur Thorarinsson <[email protected]>
Commit-Queue: Tatsuhisa Yamaguchi <[email protected]>
Cr-Commit-Position: refs/heads/master@{#511780}
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index 29fc32f..d94e52d 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -464,6 +464,7 @@
LoadExtensionsFromCommandLineFlag(switches::kDisableExtensionsExcept);
if (load_command_line_extensions)
LoadExtensionsFromCommandLineFlag(extensions::switches::kLoadExtension);
+ EnableZipUnpackerExtension();
EnabledReloadableExtensions();
MaybeFinishShutdownDelayed();
SetReadyAndNotifyListeners();
@@ -477,6 +478,24 @@
LoadGreylistFromPrefs();
}
+void ExtensionService::EnableZipUnpackerExtensionForTest() {
+ EnableZipUnpackerExtension();
+}
+
+void ExtensionService::EnableZipUnpackerExtension() {
+ TRACE_EVENT0("browser,startup",
+ "ExtensionService::EnableZipUnpackerExtension");
+
+#if defined(OS_CHROMEOS)
+ // There were some cases where the Zip Unpacker was disabled in the profile,
+ // by some reason, and cannot re-enable it in any UI. crbug.com/643060
+ const std::string& id = extension_misc::kZIPUnpackerExtensionId;
+ const Extension* extension = registry_->disabled_extensions().GetByID(id);
+ if (extension && CanEnableExtension(extension))
+ EnableExtension(id);
+#endif
+}
+
void ExtensionService::EnabledReloadableExtensions() {
TRACE_EVENT0("browser,startup",
"ExtensionService::EnabledReloadableExtensions");