Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_MAC_H_ | 5 #ifndef CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_MAC_H_ |
| 6 #define CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_MAC_H_ | 6 #define CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_MAC_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "chrome/browser/shell_integration.h" | 10 #include "chrome/browser/shell_integration.h" |
| 11 | 11 |
| 12 @class NSString; | |
| 13 | |
| 12 namespace web_app { | 14 namespace web_app { |
| 13 | 15 |
| 14 // Creates a shortcut for a web application. The shortcut is a stub app | 16 // Creates a shortcut for a web application. The shortcut is a stub app |
| 15 // that simply loads the browser framework and runs the given app. | 17 // that simply loads the browser framework and runs the given app. |
| 16 class WebAppShortcutCreator { | 18 class WebAppShortcutCreator { |
| 17 public: | 19 public: |
| 18 // Creates a new shortcut based on information in |shortcut_info|. | 20 // Creates a new shortcut based on information in |shortcut_info|. |
| 19 explicit WebAppShortcutCreator( | 21 explicit WebAppShortcutCreator( |
| 20 const ShellIntegration::ShortcutInfo& shortcut_info); | 22 const ShellIntegration::ShortcutInfo& shortcut_info); |
| 21 virtual ~WebAppShortcutCreator(); | 23 virtual ~WebAppShortcutCreator(); |
| 22 | 24 |
| 23 // Creates a shortcut. | 25 // Copies the app launcher template into place and fills in all relevant |
| 24 bool CreateShortcut(); | 26 // information. |
| 27 // |chrome_bundle_id| - CFBundleIdentifier of the Chrome browser bundle. | |
| 28 bool CreateShortcut(NSString* chrome_bundle_id); | |
|
sail
2012/02/17 16:42:09
Instead of passing the bundle ID to create shortcu
jeremy
2012/02/19 14:36:41
Done.
| |
| 25 | 29 |
| 26 protected: | 30 protected: |
| 27 // Returns a path to the app loader. | 31 // Returns a path to the app loader. |
| 28 FilePath GetAppLoaderPath() const; | 32 FilePath GetAppLoaderPath() const; |
| 29 | 33 |
| 30 // Returns a path to the destination where the app should be written to. | 34 // Returns a path to the destination where the app should be written to. |
| 31 virtual FilePath GetDestinationPath(const FilePath& app_file_name) const; | 35 virtual FilePath GetDestinationPath(const FilePath& app_file_name) const; |
| 32 | 36 |
| 33 // Updates the plist inside |app_path| with information about the app. | 37 // Updates the plist inside |app_path| with information about the app. |
| 34 bool UpdatePlist(const FilePath& app_path) const; | 38 bool UpdatePlist(const FilePath& app_path, NSString* chrome_bundle_id) const; |
| 35 | 39 |
| 36 // Updates the icon for the shortcut. | 40 // Updates the icon for the shortcut. |
| 37 bool UpdateIcon(const FilePath& app_path) const; | 41 bool UpdateIcon(const FilePath& app_path) const; |
| 38 | 42 |
| 39 private: | 43 private: |
| 40 // Information about the app. | 44 // Information about the app. |
| 41 ShellIntegration::ShortcutInfo info_; | 45 ShellIntegration::ShortcutInfo info_; |
| 42 }; | 46 }; |
| 43 | 47 |
| 44 } // namespace web_app | 48 } // namespace web_app |
| 45 | 49 |
| 46 #endif // CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_MAC_H_ | 50 #endif // CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_MAC_H_ |
| OLD | NEW |