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 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... | |
28 // Returns the full path of the .app shim that would be created by | 28 // Returns the full path of the .app shim that would be created by |
29 // CreateShortcuts(). | 29 // CreateShortcuts(). |
30 base::FilePath GetAppInstallPath(const ShortcutInfo& shortcut_info); | 30 base::FilePath GetAppInstallPath(const ShortcutInfo& shortcut_info); |
31 | 31 |
32 // If necessary, launch the shortcut for an app. | 32 // If necessary, launch the shortcut for an app. |
33 void MaybeLaunchShortcut(const ShortcutInfo& shortcut_info); | 33 void MaybeLaunchShortcut(const ShortcutInfo& shortcut_info); |
34 | 34 |
35 // Rebuild the shortcut and relaunch it. | 35 // Rebuild the shortcut and relaunch it. |
36 bool MaybeRebuildShortcut(const base::CommandLine& command_line); | 36 bool MaybeRebuildShortcut(const base::CommandLine& command_line); |
37 | 37 |
38 // Reveals app shim in finder given a profile and app. | |
Robert Sesek
2014/12/05 18:30:37
nit: capitalize Finder
mitchellj
2014/12/09 01:39:52
Acknowledged.
| |
39 // Calls RevealAppShimInFinderForAppOnFileThread and schedules it | |
40 // on the FILE thread. | |
41 void RevealAppShimInFinderForApp(Profile* profile, | |
42 const extensions::Extension* app); | |
43 | |
38 // Creates a shortcut for a web application. The shortcut is a stub app | 44 // Creates a shortcut for a web application. The shortcut is a stub app |
39 // that simply loads the browser framework and runs the given app. | 45 // that simply loads the browser framework and runs the given app. |
40 class WebAppShortcutCreator { | 46 class WebAppShortcutCreator { |
41 public: | 47 public: |
42 // Creates a new shortcut based on information in |shortcut_info|. | 48 // Creates a new shortcut based on information in |shortcut_info|. |
43 // A copy of the shortcut is placed in |app_data_dir|. | 49 // A copy of the shortcut is placed in |app_data_dir|. |
44 // |chrome_bundle_id| is the CFBundleIdentifier of the Chrome browser bundle. | 50 // |chrome_bundle_id| is the CFBundleIdentifier of the Chrome browser bundle. |
45 WebAppShortcutCreator(const base::FilePath& app_data_dir, | 51 WebAppShortcutCreator(const base::FilePath& app_data_dir, |
46 const ShortcutInfo& shortcut_info, | 52 const ShortcutInfo& shortcut_info, |
47 const extensions::FileHandlersInfo& file_handlers_info); | 53 const extensions::FileHandlersInfo& file_handlers_info); |
(...skipping 11 matching lines...) Expand all Loading... | |
59 base::FilePath GetApplicationsShortcutPath() const; | 65 base::FilePath GetApplicationsShortcutPath() const; |
60 | 66 |
61 // The full path to the app bundle under the profile folder. | 67 // The full path to the app bundle under the profile folder. |
62 base::FilePath GetInternalShortcutPath() const; | 68 base::FilePath GetInternalShortcutPath() const; |
63 | 69 |
64 bool CreateShortcuts(ShortcutCreationReason creation_reason, | 70 bool CreateShortcuts(ShortcutCreationReason creation_reason, |
65 ShortcutLocations creation_locations); | 71 ShortcutLocations creation_locations); |
66 void DeleteShortcuts(); | 72 void DeleteShortcuts(); |
67 bool UpdateShortcuts(); | 73 bool UpdateShortcuts(); |
68 | 74 |
75 // Show the bundle we just generated in the Finder. | |
76 virtual void RevealAppShimInFinder() const; | |
77 | |
69 protected: | 78 protected: |
70 // Returns a path to an app bundle with the given id. Or an empty path if no | 79 // Returns a path to an app bundle with the given id. Or an empty path if no |
71 // matching bundle was found. | 80 // matching bundle was found. |
72 // Protected and virtual so it can be mocked out for testing. | 81 // Protected and virtual so it can be mocked out for testing. |
73 virtual base::FilePath GetAppBundleById(const std::string& bundle_id) const; | 82 virtual base::FilePath GetAppBundleById(const std::string& bundle_id) const; |
74 | 83 |
75 // Show the bundle we just generated in the Finder. | |
76 virtual void RevealAppShimInFinder() const; | |
77 | |
78 private: | 84 private: |
79 FRIEND_TEST_ALL_PREFIXES(WebAppShortcutCreatorTest, DeleteShortcuts); | 85 FRIEND_TEST_ALL_PREFIXES(WebAppShortcutCreatorTest, DeleteShortcuts); |
80 FRIEND_TEST_ALL_PREFIXES(WebAppShortcutCreatorTest, UpdateIcon); | 86 FRIEND_TEST_ALL_PREFIXES(WebAppShortcutCreatorTest, UpdateIcon); |
81 FRIEND_TEST_ALL_PREFIXES(WebAppShortcutCreatorTest, UpdateShortcuts); | 87 FRIEND_TEST_ALL_PREFIXES(WebAppShortcutCreatorTest, UpdateShortcuts); |
82 | 88 |
83 // Returns the bundle identifier to use for this app bundle. | 89 // Returns the bundle identifier to use for this app bundle. |
84 std::string GetBundleIdentifier() const; | 90 std::string GetBundleIdentifier() const; |
85 | 91 |
86 // Returns the bundle identifier for the internal copy of the bundle. | 92 // Returns the bundle identifier for the internal copy of the bundle. |
87 std::string GetInternalBundleIdentifier() const; | 93 std::string GetInternalBundleIdentifier() const; |
(...skipping 28 matching lines...) Expand all Loading... | |
116 | 122 |
117 // The app's file handlers. | 123 // The app's file handlers. |
118 extensions::FileHandlersInfo file_handlers_info_; | 124 extensions::FileHandlersInfo file_handlers_info_; |
119 | 125 |
120 DISALLOW_COPY_AND_ASSIGN(WebAppShortcutCreator); | 126 DISALLOW_COPY_AND_ASSIGN(WebAppShortcutCreator); |
121 }; | 127 }; |
122 | 128 |
123 } // namespace web_app | 129 } // namespace web_app |
124 | 130 |
125 #endif // CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_MAC_H_ | 131 #endif // CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_MAC_H_ |
OLD | NEW |