diff options
author | mgiuca@chromium.org <mgiuca@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-03 23:31:25 +0000 |
---|---|---|
committer | mgiuca@chromium.org <mgiuca@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-03 23:31:25 +0000 |
commit | 07df65c8917391fb44548531a850cd1043bcbf76 (patch) | |
tree | dd49640c00ab466283548011c43a110addcf04ce /chrome/browser/web_applications | |
parent | d3aa614545bb56e61c9a4344143d5b1e9e83cb57 (diff) | |
download | chromium_src-07df65c8917391fb44548531a850cd1043bcbf76.zip chromium_src-07df65c8917391fb44548531a850cd1043bcbf76.tar.gz chromium_src-07df65c8917391fb44548531a850cd1043bcbf76.tar.bz2 |
Windows, Linux: auto-create app menu shortcuts when an app is installed.
When an app is updated (as opposed to installed), existing shortcuts are
refreshed, but new shortcuts are not created.
BUG=177579
BUG=234041
Review URL: https://chromiumcodereview.appspot.com/14682008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@198238 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/web_applications')
-rw-r--r-- | chrome/browser/web_applications/web_app.cc | 6 | ||||
-rw-r--r-- | chrome/browser/web_applications/web_app.h | 6 | ||||
-rw-r--r-- | chrome/browser/web_applications/web_app_linux.cc | 4 | ||||
-rw-r--r-- | chrome/browser/web_applications/web_app_win.cc | 7 |
4 files changed, 18 insertions, 5 deletions
diff --git a/chrome/browser/web_applications/web_app.cc b/chrome/browser/web_applications/web_app.cc index d0b01a2..931af3e 100644 --- a/chrome/browser/web_applications/web_app.cc +++ b/chrome/browser/web_applications/web_app.cc @@ -16,6 +16,8 @@ #include "chrome/common/url_constants.h" #include "content/public/browser/browser_thread.h" #include "extensions/common/constants.h" +#include "grit/chromium_strings.h" +#include "ui/base/l10n/l10n_util.h" using content::BrowserThread; @@ -225,4 +227,8 @@ std::string GetWMClassFromAppName(std::string app_name) { } #endif +string16 GetAppShortcutsSubdirName() { + return l10n_util::GetStringUTF16(IDS_APP_SHORTCUTS_SUBDIR_NAME); +} + } // namespace web_app diff --git a/chrome/browser/web_applications/web_app.h b/chrome/browser/web_applications/web_app.h index af86986..1de6fcf 100644 --- a/chrome/browser/web_applications/web_app.h +++ b/chrome/browser/web_applications/web_app.h @@ -61,7 +61,8 @@ void CreateShortcuts( // |shortcut_data| in the profile with |profile_path|. void DeleteAllShortcuts(const ShellIntegration::ShortcutInfo& shortcut_info); -// Updates shortcuts for web application based on given shortcut data. +// Updates shortcuts for web application based on given shortcut data. This +// refreshes existing shortcuts and their icons, but does not create new ones. // |shortcut_info| contains information about the shortcuts to update. void UpdateAllShortcuts(const ShellIntegration::ShortcutInfo& shortcut_info); @@ -91,6 +92,9 @@ void GetIconsInfo(const WebApplicationInfo& app_info, std::string GetWMClassFromAppName(std::string app_name); #endif +// Gets the name of the Chrome Apps menu folder in which to place app shortcuts. +string16 GetAppShortcutsSubdirName(); + namespace internals { #if defined(OS_WIN) diff --git a/chrome/browser/web_applications/web_app_linux.cc b/chrome/browser/web_applications/web_app_linux.cc index 33efa74..445c921 100644 --- a/chrome/browser/web_applications/web_app_linux.cc +++ b/chrome/browser/web_applications/web_app_linux.cc @@ -45,6 +45,10 @@ void UpdatePlatformShortcuts( // not show it in the menu. creation_locations.hidden = true; + // Always create the shortcut in the Chrome Apps subdir (even if it is + // currently in a different location). + creation_locations.applications_menu_subdir = GetAppShortcutsSubdirName(); + CreatePlatformShortcuts(web_app_path, shortcut_info, creation_locations); } diff --git a/chrome/browser/web_applications/web_app_win.cc b/chrome/browser/web_applications/web_app_win.cc index ff5783b..f101f69 100644 --- a/chrome/browser/web_applications/web_app_win.cc +++ b/chrome/browser/web_applications/web_app_win.cc @@ -20,8 +20,6 @@ #include "chrome/installer/launcher_support/chrome_launcher_support.h" #include "chrome/installer/util/util_constants.h" #include "content/public/browser/browser_thread.h" -#include "grit/chromium_strings.h" -#include "ui/base/l10n/l10n_util.h" #include "ui/gfx/icon_util.h" #include "ui/gfx/image/image.h" #include "ui/gfx/image/image_family.h" @@ -274,6 +272,8 @@ bool CreatePlatformShortcuts( void UpdatePlatformShortcuts( const base::FilePath& web_app_path, const ShellIntegration::ShortcutInfo& shortcut_info) { + DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); + // Generates file name to use with persisted ico and shortcut file. base::FilePath file_name = web_app::internals::GetSanitizedFileName(shortcut_info.title); @@ -300,8 +300,7 @@ void DeletePlatformShortcuts( // Delete shortcuts from the Chrome Apps subdirectory. // This matches the subdir name set by CreateApplicationShortcutView::Accept // for Chrome apps (not URL apps, but this function does not apply for them). - string16 start_menu_subdir = - l10n_util::GetStringUTF16(IDS_APP_SHORTCUTS_SUBDIR_NAME); + string16 start_menu_subdir = GetAppShortcutsSubdirName(); all_shortcut_locations.applications_menu_subdir = start_menu_subdir; std::vector<base::FilePath> shortcut_paths = GetShortcutPaths( all_shortcut_locations); |