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