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 typedef base::Callback<void(const web_app::ShortcutInfo&, | |
tapted
2014/05/05 07:02:01
nit: this should have a comment
jackhou1
2014/05/06 04:47:58
Done.
| |
103 const extensions::FileHandlersInfo&)> InfoCallback; | |
104 | |
102 typedef base::Callback<void(const web_app::ShortcutInfo&)> | 105 typedef base::Callback<void(const web_app::ShortcutInfo&)> |
103 ShortcutInfoCallback; | 106 ShortcutInfoCallback; |
104 | 107 |
105 // Extracts shortcut info of the given WebContents. | 108 // Extracts shortcut info of the given WebContents. |
106 void GetShortcutInfoForTab(content::WebContents* web_contents, | 109 void GetShortcutInfoForTab(content::WebContents* web_contents, |
107 web_app::ShortcutInfo* info); | 110 web_app::ShortcutInfo* info); |
108 | 111 |
109 // Updates web app shortcut of the WebContents. This function checks and | 112 // Updates web app shortcut of the WebContents. This function checks and |
110 // updates web app icon and shortcuts if needed. For icon, the check is based | 113 // updates web app icon and shortcuts if needed. For icon, the check is based |
111 // on MD5 hash of icon image. For shortcuts, it checks the desktop, start menu | 114 // on MD5 hash of icon image. For shortcuts, it checks the desktop, start menu |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
190 | 193 |
191 #if defined(OS_LINUX) | 194 #if defined(OS_LINUX) |
192 // Windows that correspond to web apps need to have a deterministic (and | 195 // Windows that correspond to web apps need to have a deterministic (and |
193 // different) WMClass than normal chrome windows so the window manager groups | 196 // different) WMClass than normal chrome windows so the window manager groups |
194 // them as a separate application. | 197 // them as a separate application. |
195 std::string GetWMClassFromAppName(std::string app_name); | 198 std::string GetWMClassFromAppName(std::string app_name); |
196 #endif | 199 #endif |
197 | 200 |
198 namespace internals { | 201 namespace internals { |
199 | 202 |
203 // Loads relevant info structs for the app and calls |callback|. | |
204 void GetInfoForApp(const extensions::Extension* extension, | |
205 Profile* profile, | |
206 const InfoCallback& callback); | |
207 | |
200 #if defined(OS_WIN) | 208 #if defined(OS_WIN) |
201 // Returns the Windows user-level shortcut paths that are specified in | 209 // Returns the Windows user-level shortcut paths that are specified in |
202 // |creation_locations|. | 210 // |creation_locations|. |
203 std::vector<base::FilePath> GetShortcutPaths( | 211 std::vector<base::FilePath> GetShortcutPaths( |
204 const web_app::ShortcutLocations& creation_locations); | 212 const web_app::ShortcutLocations& creation_locations); |
205 #endif | 213 #endif |
206 | 214 |
207 // Creates a shortcut. Must be called on the file thread. This is used to | 215 // 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 | 216 // implement CreateShortcuts() above, and can also be used directly from the |
209 // file thread. |shortcut_info| contains info about the shortcut to create, and | 217 // file thread. |shortcut_info| contains info about the shortcut to create, and |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
248 | 256 |
249 // 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 |
250 // on-disk file name . | 258 // on-disk file name . |
251 base::FilePath GetSanitizedFileName(const base::string16& name); | 259 base::FilePath GetSanitizedFileName(const base::string16& name); |
252 | 260 |
253 } // namespace internals | 261 } // namespace internals |
254 | 262 |
255 } // namespace web_app | 263 } // namespace web_app |
256 | 264 |
257 #endif // CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_H_ | 265 #endif // CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_H_ |
OLD | NEW |