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/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
11 #include "chrome/browser/shell_integration.h" | 11 #include "chrome/browser/shell_integration.h" |
12 | 12 |
13 namespace web_app { | 13 namespace web_app { |
14 | 14 |
15 // Creates a shortcut for a web application. The shortcut is a stub app | 15 // Creates a shortcut for a web application. The shortcut is a stub app |
16 // that simply loads the browser framework and runs the given app. | 16 // that simply loads the browser framework and runs the given app. |
17 class WebAppShortcutCreator { | 17 class WebAppShortcutCreator { |
18 public: | 18 public: |
19 // Creates a new shortcut based on information in |shortcut_info|. | 19 // Creates a new shortcut based on information in |shortcut_info|. |
| 20 // The shortcut stores its user data directory in |user_data_dir|. |
20 explicit WebAppShortcutCreator( | 21 explicit WebAppShortcutCreator( |
| 22 const FilePath& user_data_dir, |
21 const ShellIntegration::ShortcutInfo& shortcut_info); | 23 const ShellIntegration::ShortcutInfo& shortcut_info); |
22 virtual ~WebAppShortcutCreator(); | 24 virtual ~WebAppShortcutCreator(); |
23 | 25 |
24 // Creates a shortcut. | 26 // Creates a shortcut. |
25 bool CreateShortcut(); | 27 bool CreateShortcut(); |
26 | 28 |
27 protected: | 29 protected: |
28 // Returns a path to the app loader. | 30 // Returns a path to the app loader. |
29 FilePath GetAppLoaderPath() const; | 31 FilePath GetAppLoaderPath() const; |
30 | 32 |
31 // Returns a path to the destination where the app should be written to. | 33 // Returns a path to the destination where the app should be written to. |
32 virtual FilePath GetDestinationPath(const FilePath& app_file_name) const; | 34 virtual FilePath GetDestinationPath(const FilePath& app_file_name) const; |
33 | 35 |
34 // Updates the plist inside |app_path| with information about the app. | 36 // Updates the plist inside |app_path| with information about the app. |
35 bool UpdatePlist(const FilePath& app_path) const; | 37 bool UpdatePlist(const FilePath& app_path) const; |
36 | 38 |
37 // Updates the icon for the shortcut. | 39 // Updates the icon for the shortcut. |
38 bool UpdateIcon(const FilePath& app_path) const; | 40 bool UpdateIcon(const FilePath& app_path) const; |
39 | 41 |
40 private: | 42 private: |
41 FRIEND_TEST_ALL_PREFIXES(WebAppShortcutCreatorTest, UpdateIcon); | 43 FRIEND_TEST_ALL_PREFIXES(WebAppShortcutCreatorTest, UpdateIcon); |
42 | 44 |
| 45 // Path to the app's user data directory. For example: |
| 46 // ~/Library/Application Support/Chromium/Default/Web Applications/_crx_abc/ |
| 47 // Note, the user data directory is the parent of the profile directory. |
| 48 FilePath user_data_dir_; |
| 49 |
43 // Information about the app. | 50 // Information about the app. |
44 ShellIntegration::ShortcutInfo info_; | 51 ShellIntegration::ShortcutInfo info_; |
45 }; | 52 }; |
46 | 53 |
47 } // namespace web_app | 54 } // namespace web_app |
48 | 55 |
49 #endif // CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_MAC_H_ | 56 #endif // CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_MAC_H_ |
OLD | NEW |