summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authortapted@chromium.org <tapted@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-20 02:59:30 +0000
committertapted@chromium.org <tapted@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-20 02:59:30 +0000
commitecc06f1640c85ec991f240d563934557c88dc7e9 (patch)
treeee41fb746114324efc5d76a76c072ed8f404f6b8 /chrome/browser
parent769acedbfe8b896bfbee576cca302b4ea63b4350 (diff)
downloadchromium_src-ecc06f1640c85ec991f240d563934557c88dc7e9.zip
chromium_src-ecc06f1640c85ec991f240d563934557c88dc7e9.tar.gz
chromium_src-ecc06f1640c85ec991f240d563934557c88dc7e9.tar.bz2
Re-use the OSX App Launcher shim for all profiles.
Currently, switching your app list profile will cause a new shim to be created on the next restart. However, the app list shortcut is the same for all profiles. This CL avoids prepending the profile path on to the app bundle name when no profile name is set on the ShortcutInfo. BUG=138633 TEST=Added WebAppShortcutCreatorTest.CreateAppListShortcut Review URL: https://chromiumcodereview.appspot.com/17202004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@207290 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/web_applications/web_app_mac.mm13
-rw-r--r--chrome/browser/web_applications/web_app_mac_unittest.mm17
2 files changed, 27 insertions, 3 deletions
diff --git a/chrome/browser/web_applications/web_app_mac.mm b/chrome/browser/web_applications/web_app_mac.mm
index 224c79860..4d67fc8 100644
--- a/chrome/browser/web_applications/web_app_mac.mm
+++ b/chrome/browser/web_applications/web_app_mac.mm
@@ -241,9 +241,16 @@ base::FilePath WebAppShortcutCreator::GetShortcutPath() const {
if (dst_path.empty())
return dst_path;
- base::FilePath app_name = internals::GetSanitizedFileName(UTF8ToUTF16(
- info_.profile_path.BaseName().value() + " " + info_.extension_id));
- return dst_path.Append(app_name.ReplaceExtension("app"));
+ std::string app_name;
+ // Check if there should be a separate shortcut made for different profiles.
+ // Such shortcuts will have a |profile_name| set on the ShortcutInfo,
+ // otherwise it will be empty.
+ if (!info_.profile_name.empty()) {
+ app_name += info_.profile_path.BaseName().value();
+ app_name += ' ';
+ }
+ app_name += info_.extension_id;
+ return dst_path.Append(app_name).ReplaceExtension("app");
}
bool WebAppShortcutCreator::CreateShortcut() {
diff --git a/chrome/browser/web_applications/web_app_mac_unittest.mm b/chrome/browser/web_applications/web_app_mac_unittest.mm
index b82a0d5..18ada70 100644
--- a/chrome/browser/web_applications/web_app_mac_unittest.mm
+++ b/chrome/browser/web_applications/web_app_mac_unittest.mm
@@ -107,6 +107,23 @@ TEST(WebAppShortcutCreatorTest, CreateShortcut) {
}
}
+TEST(WebAppShortcutCreatorTest, CreateAppListShortcut) {
+ base::ScopedTempDir scoped_temp_dir;
+ EXPECT_TRUE(scoped_temp_dir.CreateUniqueTempDir());
+ base::FilePath dst_folder = scoped_temp_dir.path();
+ ShellIntegration::ShortcutInfo info = GetShortcutInfo();
+
+ // With an empty |profile_name|, the shortcut path should not have the profile
+ // directory prepended to the extension id on the app bundle name.
+ info.profile_name.clear();
+ base::FilePath dst_path = dst_folder.Append(info.extension_id + ".app");
+
+ NiceMock<WebAppShortcutCreatorMock> shortcut_creator(base::FilePath(), info);
+ EXPECT_CALL(shortcut_creator, GetDestinationPath())
+ .WillRepeatedly(Return(dst_folder));
+ EXPECT_EQ(dst_path.value(), shortcut_creator.GetShortcutPath().value());
+}
+
TEST(WebAppShortcutCreatorTest, RunShortcut) {
base::ScopedTempDir temp_app_data_path;
EXPECT_TRUE(temp_app_data_path.CreateUniqueTempDir());