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

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

Issue 1424663005: Prevent browser crashes when a site is added to shelf with extensions blacklisted. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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:
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698