Index: chrome/browser/extensions/bookmark_app_helper.cc |
diff --git a/chrome/browser/extensions/bookmark_app_helper.cc b/chrome/browser/extensions/bookmark_app_helper.cc |
index 5b1e5ef60ee82745bf5542ce8e0244a4d75f41ff..79b63652cc27f0dd61a55dda9587181c3f092f01 100644 |
--- a/chrome/browser/extensions/bookmark_app_helper.cc |
+++ b/chrome/browser/extensions/bookmark_app_helper.cc |
@@ -731,14 +731,20 @@ void BookmarkAppHelper::FinishInstallation(const Extension* extension) { |
void BookmarkAppHelper::Observe(int type, |
const content::NotificationSource& source, |
const content::NotificationDetails& details) { |
+ // TODO(dominickn): bookmark app creation fails when extensions cannot be |
+ // created (e.g. due to management policies). Add to shelf visibility should |
+ // be gated on whether extensions can be created - see crbug.com/545541. |
switch (type) { |
case extensions::NOTIFICATION_CRX_INSTALLER_DONE: { |
const Extension* extension = |
content::Details<const Extension>(details).ptr(); |
- DCHECK(extension); |
- DCHECK_EQ(AppLaunchInfo::GetLaunchWebURL(extension), |
- web_app_info_.app_url); |
- FinishInstallation(extension); |
+ if (extension) { |
+ DCHECK_EQ(AppLaunchInfo::GetLaunchWebURL(extension), |
+ web_app_info_.app_url); |
+ FinishInstallation(extension); |
+ } else { |
+ callback_.Run(nullptr, web_app_info_); |
+ } |
break; |
} |
case extensions::NOTIFICATION_EXTENSION_INSTALL_ERROR: |