diff options
author | tapted@chromium.org <tapted@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-21 08:27:07 +0000 |
---|---|---|
committer | tapted@chromium.org <tapted@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-21 08:27:07 +0000 |
commit | 5538b3125381def519b5032f6c90506652cb2deb (patch) | |
tree | d7f71e9a1397caace552fc88801e2ea72aab6966 /chrome/browser/web_applications | |
parent | 9e89596c43138cd0061af8a8b0f0bccaf2c5bdfe (diff) | |
download | chromium_src-5538b3125381def519b5032f6c90506652cb2deb.zip chromium_src-5538b3125381def519b5032f6c90506652cb2deb.tar.gz chromium_src-5538b3125381def519b5032f6c90506652cb2deb.tar.bz2 |
Create an app list shim for the App Launcher on OSX in response to a startup flag.
This allows an app launcher .app shim to be created on OSX with steps:
- Quit Chrome, and
- $ open Chromium.app --args --enable-app-list-shim
Chrome will start, and a finder window will be opened showing the newly
created .app. This can then be launched and pinned to the dock.
The .app can be deleted with --enable-app-list-shim=0 (or it can be
dragged to Trash).
BUG=138633
TEST=Steps as above.
Review URL: https://chromiumcodereview.appspot.com/14760002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@201260 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/web_applications')
-rw-r--r-- | chrome/browser/web_applications/web_app_mac.h | 8 | ||||
-rw-r--r-- | chrome/browser/web_applications/web_app_mac.mm | 17 | ||||
-rw-r--r-- | chrome/browser/web_applications/web_app_mac_unittest.mm | 1 |
3 files changed, 26 insertions, 0 deletions
diff --git a/chrome/browser/web_applications/web_app_mac.h b/chrome/browser/web_applications/web_app_mac.h index 8f9b90c..236fe95 100644 --- a/chrome/browser/web_applications/web_app_mac.h +++ b/chrome/browser/web_applications/web_app_mac.h @@ -20,6 +20,11 @@ class NSString; namespace web_app { +// Returns the full path of the .app shim that would be created by +// web_app::CreateShortcuts(). +base::FilePath GetAppInstallPath( + const ShellIntegration::ShortcutInfo& shortcut_info); + // Creates a shortcut for a web application. The shortcut is a stub app // that simply loads the browser framework and runs the given app. class WebAppShortcutCreator { @@ -34,6 +39,9 @@ class WebAppShortcutCreator { virtual ~WebAppShortcutCreator(); + // Returns a path to the destination where the app should be written to. + base::FilePath GetShortcutPath() const; + // Copies the app launcher template into place and fills in all relevant // information. bool CreateShortcut(); diff --git a/chrome/browser/web_applications/web_app_mac.mm b/chrome/browser/web_applications/web_app_mac.mm index 6da9795..5c933cd 100644 --- a/chrome/browser/web_applications/web_app_mac.mm +++ b/chrome/browser/web_applications/web_app_mac.mm @@ -115,6 +115,15 @@ WebAppShortcutCreator::WebAppShortcutCreator( WebAppShortcutCreator::~WebAppShortcutCreator() { } +base::FilePath WebAppShortcutCreator::GetShortcutPath() const { + base::FilePath dst_path = GetDestinationPath(); + if (dst_path.empty()) + return dst_path; + + base::FilePath app_name = internals::GetSanitizedFileName(info_.title); + return dst_path.Append(app_name.ReplaceExtension("app")); +} + bool WebAppShortcutCreator::CreateShortcut() { base::FilePath app_name = internals::GetSanitizedFileName(info_.title); base::FilePath app_file_name = app_name.ReplaceExtension("app"); @@ -283,6 +292,14 @@ void WebAppShortcutCreator::RevealGeneratedBundleInFinder( namespace web_app { +base::FilePath GetAppInstallPath( + const ShellIntegration::ShortcutInfo& shortcut_info) { + WebAppShortcutCreator shortcut_creator(base::FilePath(), + shortcut_info, + string16()); + return shortcut_creator.GetShortcutPath(); +} + namespace internals { base::FilePath GetAppBundleByExtensionId(std::string extension_id) { diff --git a/chrome/browser/web_applications/web_app_mac_unittest.mm b/chrome/browser/web_applications/web_app_mac_unittest.mm index 2579cb36..0c08366 100644 --- a/chrome/browser/web_applications/web_app_mac_unittest.mm +++ b/chrome/browser/web_applications/web_app_mac_unittest.mm @@ -73,6 +73,7 @@ TEST(WebAppShortcutCreatorTest, CreateShortcut) { EXPECT_TRUE(shortcut_creator.CreateShortcut()); EXPECT_TRUE(file_util::PathExists(dst_path)); + EXPECT_EQ(dst_path.value(), shortcut_creator.GetShortcutPath().value()); base::FilePath plist_path = dst_path.Append("Contents").Append("Info.plist"); NSDictionary* plist = [NSDictionary dictionaryWithContentsOfFile: |