| 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 "base/string16.h" |
| 10 #include "chrome/browser/shell_integration.h" | 11 #include "chrome/browser/shell_integration.h" |
| 11 | 12 |
| 13 #ifdef __OBJC__ |
| 14 @class NSDictionary; |
| 15 @class NSString; |
| 16 #else // __OBJC__ |
| 17 class NSDictionary; |
| 18 class NSString; |
| 19 #endif // __OBJC__ |
| 20 |
| 12 namespace web_app { | 21 namespace web_app { |
| 13 | 22 |
| 14 // Creates a shortcut for a web application. The shortcut is a stub app | 23 // 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. | 24 // that simply loads the browser framework and runs the given app. |
| 16 class WebAppShortcutCreator { | 25 class WebAppShortcutCreator { |
| 17 public: | 26 public: |
| 18 // Creates a new shortcut based on information in |shortcut_info|. | 27 // Creates a new shortcut based on information in |shortcut_info|. |
| 19 explicit WebAppShortcutCreator( | 28 // |chrome_bundle_id| is the CFBundleIdentifier of the Chrome browser bundle. |
| 20 const ShellIntegration::ShortcutInfo& shortcut_info); | 29 WebAppShortcutCreator( |
| 30 const ShellIntegration::ShortcutInfo& shortcut_info, |
| 31 const string16& chrome_bundle_id); |
| 21 virtual ~WebAppShortcutCreator(); | 32 virtual ~WebAppShortcutCreator(); |
| 22 | 33 |
| 23 // Creates a shortcut. | 34 // Copies the app launcher template into place and fills in all relevant |
| 35 // information. |
| 24 bool CreateShortcut(); | 36 bool CreateShortcut(); |
| 25 | 37 |
| 26 protected: | 38 protected: |
| 27 // Returns a path to the app loader. | 39 // Returns a path to the app loader. |
| 28 FilePath GetAppLoaderPath() const; | 40 FilePath GetAppLoaderPath() const; |
| 29 | 41 |
| 30 // Returns a path to the destination where the app should be written to. | 42 // Returns a path to the destination where the app should be written to. |
| 31 virtual FilePath GetDestinationPath(const FilePath& app_file_name) const; | 43 virtual FilePath GetDestinationPath(const FilePath& app_file_name) const; |
| 32 | 44 |
| 33 // Updates the plist inside |app_path| with information about the app. | 45 // Updates the plist inside |app_path| with information about the app. |
| 34 bool UpdatePlist(const FilePath& app_path) const; | 46 bool UpdatePlist(const FilePath& app_path) const; |
| 35 | 47 |
| 36 // Updates the icon for the shortcut. | 48 // Updates the icon for the shortcut. |
| 37 bool UpdateIcon(const FilePath& app_path) const; | 49 bool UpdateIcon(const FilePath& app_path) const; |
| 38 | 50 |
| 39 private: | 51 private: |
| 52 // Returns the bundle identifier to use for this app bundle. |
| 53 // |plist| is a dictionary containg a copy of the template plist file to |
| 54 // be used for creating the app bundle. |
| 55 NSString* GetBundleIdentifier(NSDictionary* plist) const; |
| 56 |
| 40 // Information about the app. | 57 // Information about the app. |
| 41 ShellIntegration::ShortcutInfo info_; | 58 ShellIntegration::ShortcutInfo info_; |
| 59 |
| 60 // The CFBundleIdentifier of the Chrome browser bundle. |
| 61 string16 chrome_bundle_id_; |
| 42 }; | 62 }; |
| 43 | 63 |
| 44 } // namespace web_app | 64 } // namespace web_app |
| 45 | 65 |
| 46 #endif // CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_MAC_H_ | 66 #endif // CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_MAC_H_ |
| OLD | NEW |