Index: chrome/browser/web_applications/web_app.cc |
diff --git a/chrome/browser/web_applications/web_app.cc b/chrome/browser/web_applications/web_app.cc |
index 02f227757f62472cfa2c8f8db8486b616c9af242..91c8f105ae14b87a27a60b50d382708dd9850223 100644 |
--- a/chrome/browser/web_applications/web_app.cc |
+++ b/chrome/browser/web_applications/web_app.cc |
@@ -12,8 +12,10 @@ |
#include "base/strings/string_util.h" |
#include "base/strings/utf_string_conversions.h" |
#include "base/threading/thread.h" |
+#include "chrome/browser/browser_process.h" |
#include "chrome/browser/extensions/extension_ui_util.h" |
#include "chrome/browser/profiles/profile.h" |
+#include "chrome/browser/profiles/profile_manager.h" |
#include "chrome/common/chrome_constants.h" |
#include "chrome/common/chrome_version_info.h" |
#include "chrome/common/extensions/manifest_handlers/app_launch_info.h" |
@@ -268,7 +270,7 @@ void GetShortcutInfoForApp(const extensions::Extension* extension, |
bool ShouldCreateShortcutFor(Profile* profile, |
const extensions::Extension* extension) { |
- return extension->is_platform_app() && |
+ return (extension->is_platform_app() || extension->is_hosted_app()) && |
jackhou1
2014/12/04 06:37:11
You'll need to #if-def this to just Mac. I just ch
mitchellj
2014/12/04 22:48:40
Done.
|
extension->location() != extensions::Manifest::COMPONENT && |
extensions::ui_util::CanDisplayInAppLauncher(extension, profile); |
} |
@@ -343,6 +345,21 @@ void CreateShortcutsWithInfo( |
const extensions::FileHandlersInfo& file_handlers_info) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
+ // It's possible for the extension to be deleted before we get here. |
+ // For example, creating a hosted app from a website. Double check that |
+ // it still exists. |
+ Profile* profile = g_browser_process->profile_manager()->GetProfileByPath( |
+ shortcut_info.profile_path); |
+ if (!profile) |
+ return; |
+ |
+ extensions::ExtensionRegistry* registry = |
+ extensions::ExtensionRegistry::Get(profile); |
+ const extensions::Extension* extension = registry->GetExtensionById( |
+ shortcut_info.extension_id, extensions::ExtensionRegistry::ENABLED); |
+ if (!extension) |
+ return; |
+ |
BrowserThread::PostTask( |
BrowserThread::FILE, |
FROM_HERE, |