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

Unified Diff: chrome/browser/ui/browser_init.cc

Issue 5273004: Add "create Application Shortcut" to the app menu on NTP. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase for commit. Created 10 years, 1 month 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 | « chrome/browser/ui/browser.cc ('k') | chrome/browser/ui/browser_window.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/browser_init.cc
diff --git a/chrome/browser/ui/browser_init.cc b/chrome/browser/ui/browser_init.cc
index e0a7ff5b572bf0a69d839b7800a724b0906bc2c8..cc26ca6f8313ac6652ab7fd3b99d81fcbcbdf707 100644
--- a/chrome/browser/ui/browser_init.cc
+++ b/chrome/browser/ui/browser_init.cc
@@ -620,8 +620,25 @@ bool BrowserInit::LaunchWithProfile::OpenApplicationWindow(Profile* profile) {
// extension is external, and has not yet been installed.
// TODO(skerner): Do something reasonable here. Pop up a warning panel?
// Open an URL to the gallery page of the extension id?
- if (!app_id.empty())
- return Browser::OpenApplication(profile, app_id, NULL) != NULL;
+ if (!app_id.empty()) {
+ ExtensionsService* extensions_service = profile->GetExtensionsService();
+ const Extension* extension =
+ extensions_service->GetExtensionById(app_id, false);
+
+ // The extension with |app_id| may have been uninstalled.
+ if (!extension)
+ return false;
+
+ // Look at prefs to find the container in which an app should launch.
+ // If no preference is set, launch in a window.
+ extension_misc::LaunchContainer launch_container =
+ extensions_service->extension_prefs()->GetLaunchContainer(
+ extension, ExtensionPrefs::LAUNCH_WINDOW);
+
+ TabContents* app_window = Browser::OpenApplication(
+ profile, extension, launch_container, NULL);
+ return (app_window != NULL);
+ }
if (url_string.empty())
return false;
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | chrome/browser/ui/browser_window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698