diff options
author | benwells@chromium.org <benwells@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-27 04:55:38 +0000 |
---|---|---|
committer | benwells@chromium.org <benwells@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-27 04:55:38 +0000 |
commit | 3e3ad7f609ab3913c48a6e51d9761cb74b1b3305 (patch) | |
tree | 3a1ecaa576ed87d052956986f5fcd30ae78bfe66 /chrome | |
parent | 9703a394a7eb75ad2ef2c4df970e4fd2199d98c3 (diff) | |
download | chromium_src-3e3ad7f609ab3913c48a6e51d9761cb74b1b3305.zip chromium_src-3e3ad7f609ab3913c48a6e51d9761cb74b1b3305.tar.gz chromium_src-3e3ad7f609ab3913c48a6e51d9761cb74b1b3305.tar.bz2 |
[win] Don't use app_host.exe for v1 apps.
The app_host won't be installed for v1 apps, so may not be on the system. It should not be used for shortcuts.
BUG=160479
TEST=Check on Windows that the Create Shortcuts... command works for all types of apps.
Review URL: https://chromiumcodereview.appspot.com/11413134
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@169573 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/extensions/app_shortcut_manager.cc | 8 | ||||
-rw-r--r-- | chrome/browser/shell_integration.cc | 3 | ||||
-rw-r--r-- | chrome/browser/shell_integration.h | 1 | ||||
-rw-r--r-- | chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.cc | 7 | ||||
-rw-r--r-- | chrome/browser/ui/views/create_application_shortcut_view.cc | 8 | ||||
-rw-r--r-- | chrome/browser/ui/web_applications/web_app_ui.cc | 13 | ||||
-rw-r--r-- | chrome/browser/ui/web_applications/web_app_ui.h | 13 | ||||
-rw-r--r-- | chrome/browser/web_applications/web_app_win.cc | 16 |
8 files changed, 44 insertions, 25 deletions
diff --git a/chrome/browser/extensions/app_shortcut_manager.cc b/chrome/browser/extensions/app_shortcut_manager.cc index 40bd4b9..381385c 100644 --- a/chrome/browser/extensions/app_shortcut_manager.cc +++ b/chrome/browser/extensions/app_shortcut_manager.cc @@ -10,6 +10,7 @@ #include "base/logging.h" #include "base/utf_string_conversions.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/ui/web_applications/web_app_ui.h" #include "chrome/browser/web_applications/web_app.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" @@ -38,15 +39,10 @@ const int kDesiredSizes[] = {32}; ShellIntegration::ShortcutInfo ShortcutInfoForExtensionAndProfile( const Extension* extension, Profile* profile) { ShellIntegration::ShortcutInfo shortcut_info; - shortcut_info.extension_id = extension->id(); - shortcut_info.url = GURL(extension->launch_web_url()); - shortcut_info.title = UTF8ToUTF16(extension->name()); - shortcut_info.description = UTF8ToUTF16(extension->description()); - shortcut_info.extension_path = extension->path(); + web_app::UpdateShortcutInfoForApp(*extension, profile, &shortcut_info); shortcut_info.create_in_applications_menu = true; shortcut_info.create_in_quick_launch_bar = true; shortcut_info.create_on_desktop = true; - shortcut_info.profile_path = profile->GetPath(); return shortcut_info; } diff --git a/chrome/browser/shell_integration.cc b/chrome/browser/shell_integration.cc index 3c8387e..26ef019 100644 --- a/chrome/browser/shell_integration.cc +++ b/chrome/browser/shell_integration.cc @@ -26,7 +26,8 @@ ShellIntegration::DefaultWebClientSetPermission } ShellIntegration::ShortcutInfo::ShortcutInfo() - : create_on_desktop(false), + : is_platform_app(false), + create_on_desktop(false), create_in_applications_menu(false), create_in_quick_launch_bar(false) { } diff --git a/chrome/browser/shell_integration.h b/chrome/browser/shell_integration.h index c6c1b303..1249e68 100644 --- a/chrome/browser/shell_integration.h +++ b/chrome/browser/shell_integration.h @@ -93,6 +93,7 @@ class ShellIntegration { // and the launch url will be detected at start-up. In this case, |url| // is still used to generate the app id (windows app id, not chrome app id). std::string extension_id; + bool is_platform_app; string16 title; string16 description; FilePath extension_path; diff --git a/chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.cc b/chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.cc index 25c248a..c1f5744 100644 --- a/chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.cc +++ b/chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.cc @@ -320,12 +320,7 @@ CreateChromeApplicationShortcutsDialogGtk:: ALLOW_THIS_IN_INITIALIZER_LIST(tracker_(this)) { // Get shortcut information now, it's needed for our UI. - shortcut_info_.extension_id = app_->id(); - shortcut_info_.extension_path = app_->path(); - shortcut_info_.url = GURL(app_->launch_web_url()); - shortcut_info_.title = UTF8ToUTF16(app_->name()); - shortcut_info_.description = UTF8ToUTF16(app_->description()); - shortcut_info_.profile_path = profile_path_; + web_app::UpdateShortcutInfoForApp(*app, profile, &shortcut_info_); // Get the icon. const gfx::Size max_size(kIconPreviewSizePixels, kIconPreviewSizePixels); diff --git a/chrome/browser/ui/views/create_application_shortcut_view.cc b/chrome/browser/ui/views/create_application_shortcut_view.cc index 368261a..581f230a 100644 --- a/chrome/browser/ui/views/create_application_shortcut_view.cc +++ b/chrome/browser/ui/views/create_application_shortcut_view.cc @@ -494,13 +494,7 @@ CreateChromeApplicationShortcutView::CreateChromeApplicationShortcutView( CreateApplicationShortcutView(profile), app_(app), ALLOW_THIS_IN_INITIALIZER_LIST(tracker_(this)) { - shortcut_info_.extension_id = app_->id(); - shortcut_info_.url = GURL(app_->launch_web_url()); - shortcut_info_.title = UTF8ToUTF16(app_->name()); - shortcut_info_.description = UTF8ToUTF16(app_->description()); - shortcut_info_.extension_path = app_->path(); - shortcut_info_.profile_path = profile->GetPath(); - + web_app::UpdateShortcutInfoForApp(*app, profile, &shortcut_info_); // The icon will be resized to |max_size|. const gfx::Size max_size(kAppIconSize, kAppIconSize); diff --git a/chrome/browser/ui/web_applications/web_app_ui.cc b/chrome/browser/ui/web_applications/web_app_ui.cc index 4346059..a7f9b98 100644 --- a/chrome/browser/ui/web_applications/web_app_ui.cc +++ b/chrome/browser/ui/web_applications/web_app_ui.cc @@ -18,6 +18,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/web_applications/web_app.h" #include "chrome/common/chrome_notification_types.h" +#include "chrome/common/extensions/extension.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_registrar.h" @@ -353,4 +354,16 @@ void UpdateShortcutForTabContents(WebContents* web_contents) { #endif // defined(OS_WIN) } +void UpdateShortcutInfoForApp(const extensions::Extension& app, + Profile* profile, + ShellIntegration::ShortcutInfo* shortcut_info) { + shortcut_info->extension_id = app.id(); + shortcut_info->is_platform_app = app.is_platform_app(); + shortcut_info->url = GURL(app.launch_web_url()); + shortcut_info->title = UTF8ToUTF16(app.name()); + shortcut_info->description = UTF8ToUTF16(app.description()); + shortcut_info->extension_path = app.path(); + shortcut_info->profile_path = profile->GetPath(); +} + } // namespace web_app diff --git a/chrome/browser/ui/web_applications/web_app_ui.h b/chrome/browser/ui/web_applications/web_app_ui.h index a12ddad..627ab9e 100644 --- a/chrome/browser/ui/web_applications/web_app_ui.h +++ b/chrome/browser/ui/web_applications/web_app_ui.h @@ -13,6 +13,12 @@ namespace content { class WebContents; } +namespace extensions { +class Extension; +} + +class Profile; + namespace web_app { // Extracts shortcut info of the given WebContents. @@ -26,6 +32,13 @@ void GetShortcutInfoForTab(content::WebContents* web_contents, // updates (recreates) them if they exits. void UpdateShortcutForTabContents(content::WebContents* web_contents); +// Updates the shortcut info for |extension| and |profile|. +// TODO(benwells): make this download the icon as well to remove boilerplate +// code from call sites. +void UpdateShortcutInfoForApp(const extensions::Extension& extension, + Profile* profile, + ShellIntegration::ShortcutInfo* shortcut_info); + } // namespace web_app #endif // CHROME_BROWSER_UI_WEB_APPLICATIONS_WEB_APP_UI_H_ diff --git a/chrome/browser/web_applications/web_app_win.cc b/chrome/browser/web_applications/web_app_win.cc index 8a4f416..776335a 100644 --- a/chrome/browser/web_applications/web_app_win.cc +++ b/chrome/browser/web_applications/web_app_win.cc @@ -186,6 +186,16 @@ bool CheckAndSaveIcon(const FilePath& icon_file, const SkBitmap& image) { return true; } +FilePath GetShortcutExecutablePath( + const ShellIntegration::ShortcutInfo& shortcut_info) { + if (BrowserDistribution::GetDistribution()->AppHostIsSupported() && + shortcut_info.is_platform_app) { + return chrome_launcher_support::GetAnyAppHostPath(); + } + + return chrome_launcher_support::GetAnyChromePath(); +} + bool CreatePlatformShortcuts( const FilePath& web_app_path, const ShellIntegration::ShortcutInfo& shortcut_info) { @@ -226,11 +236,7 @@ bool CreatePlatformShortcuts( return false; } - FilePath target_exe; - if (BrowserDistribution::GetDistribution()->AppHostIsSupported()) - target_exe = chrome_launcher_support::GetAnyAppHostPath(); - else - target_exe = chrome_launcher_support::GetAnyChromePath(); + FilePath target_exe = GetShortcutExecutablePath(shortcut_info); DCHECK(!target_exe.empty()); // Working directory. |