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_H_ | 5 #ifndef CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_H_ |
6 #define CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_H_ | 6 #define CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 bool in_quick_launch_bar; | 89 bool in_quick_launch_bar; |
90 }; | 90 }; |
91 | 91 |
92 // This encodes the cause of shortcut creation as the correct behavior in each | 92 // This encodes the cause of shortcut creation as the correct behavior in each |
93 // case is implementation specific. | 93 // case is implementation specific. |
94 enum ShortcutCreationReason { | 94 enum ShortcutCreationReason { |
95 SHORTCUT_CREATION_BY_USER, | 95 SHORTCUT_CREATION_BY_USER, |
96 SHORTCUT_CREATION_AUTOMATED, | 96 SHORTCUT_CREATION_AUTOMATED, |
97 }; | 97 }; |
98 | 98 |
| 99 // Called by GetInfoForApp after fetching the ShortcutInfo and FileHandlersInfo. |
| 100 typedef base::Callback<void(const ShortcutInfo&, |
| 101 const extensions::FileHandlersInfo&)> InfoCallback; |
| 102 |
| 103 // Called by UpdateShortcutInfoAndIconForApp after loading the icon. |
99 typedef base::Callback<void(const ShortcutInfo&)> ShortcutInfoCallback; | 104 typedef base::Callback<void(const ShortcutInfo&)> ShortcutInfoCallback; |
100 | 105 |
101 // Extracts shortcut info of the given WebContents. | 106 // Extracts shortcut info of the given WebContents. |
102 void GetShortcutInfoForTab(content::WebContents* web_contents, | 107 void GetShortcutInfoForTab(content::WebContents* web_contents, |
103 ShortcutInfo* info); | 108 ShortcutInfo* info); |
104 | 109 |
105 // Updates web app shortcut of the WebContents. This function checks and | 110 // Updates web app shortcut of the WebContents. This function checks and |
106 // updates web app icon and shortcuts if needed. For icon, the check is based | 111 // updates web app icon and shortcuts if needed. For icon, the check is based |
107 // on MD5 hash of icon image. For shortcuts, it checks the desktop, start menu | 112 // on MD5 hash of icon image. For shortcuts, it checks the desktop, start menu |
108 // and quick launch (as well as pinned shortcut) for shortcut and only | 113 // and quick launch (as well as pinned shortcut) for shortcut and only |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 | 195 |
191 #if defined(OS_LINUX) | 196 #if defined(OS_LINUX) |
192 // Windows that correspond to web apps need to have a deterministic (and | 197 // Windows that correspond to web apps need to have a deterministic (and |
193 // different) WMClass than normal chrome windows so the window manager groups | 198 // different) WMClass than normal chrome windows so the window manager groups |
194 // them as a separate application. | 199 // them as a separate application. |
195 std::string GetWMClassFromAppName(std::string app_name); | 200 std::string GetWMClassFromAppName(std::string app_name); |
196 #endif | 201 #endif |
197 | 202 |
198 namespace internals { | 203 namespace internals { |
199 | 204 |
| 205 // Loads relevant info structs for the app and calls |callback|. |
| 206 void GetInfoForApp(const extensions::Extension* extension, |
| 207 Profile* profile, |
| 208 const InfoCallback& callback); |
| 209 |
200 #if defined(OS_WIN) | 210 #if defined(OS_WIN) |
201 // Returns the Windows user-level shortcut paths that are specified in | 211 // Returns the Windows user-level shortcut paths that are specified in |
202 // |creation_locations|. | 212 // |creation_locations|. |
203 std::vector<base::FilePath> GetShortcutPaths( | 213 std::vector<base::FilePath> GetShortcutPaths( |
204 const ShortcutLocations& creation_locations); | 214 const ShortcutLocations& creation_locations); |
205 #endif | 215 #endif |
206 | 216 |
207 // Creates a shortcut. Must be called on the file thread. This is used to | 217 // Creates a shortcut. Must be called on the file thread. This is used to |
208 // implement CreateShortcuts() above, and can also be used directly from the | 218 // implement CreateShortcuts() above, and can also be used directly from the |
209 // file thread. |shortcut_info| contains info about the shortcut to create, and | 219 // file thread. |shortcut_info| contains info about the shortcut to create, and |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 | 256 |
247 // Sanitizes |name| and returns a version of it that is safe to use as an | 257 // Sanitizes |name| and returns a version of it that is safe to use as an |
248 // on-disk file name . | 258 // on-disk file name . |
249 base::FilePath GetSanitizedFileName(const base::string16& name); | 259 base::FilePath GetSanitizedFileName(const base::string16& name); |
250 | 260 |
251 } // namespace internals | 261 } // namespace internals |
252 | 262 |
253 } // namespace web_app | 263 } // namespace web_app |
254 | 264 |
255 #endif // CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_H_ | 265 #endif // CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_H_ |
OLD | NEW |