| 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 web_app::ShortcutInfo&, |
| 104 const extensions::FileHandlersInfo&)> InfoCallback; |
| 105 |
| 106 // Called by UpdateShortcutInfoAndIconForApp after loading the icon. |
| 102 typedef base::Callback<void(const web_app::ShortcutInfo&)> | 107 typedef base::Callback<void(const web_app::ShortcutInfo&)> |
| 103 ShortcutInfoCallback; | 108 ShortcutInfoCallback; |
| 104 | 109 |
| 105 // Extracts shortcut info of the given WebContents. | 110 // Extracts shortcut info of the given WebContents. |
| 106 void GetShortcutInfoForTab(content::WebContents* web_contents, | 111 void GetShortcutInfoForTab(content::WebContents* web_contents, |
| 107 web_app::ShortcutInfo* info); | 112 web_app::ShortcutInfo* info); |
| 108 | 113 |
| 109 // Updates web app shortcut of the WebContents. This function checks and | 114 // 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 | 115 // 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 | 116 // 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 | 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 web_app::ShortcutLocations& creation_locations); | 214 const web_app::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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 | 258 |
| 249 // Sanitizes |name| and returns a version of it that is safe to use as an | 259 // Sanitizes |name| and returns a version of it that is safe to use as an |
| 250 // on-disk file name . | 260 // on-disk file name . |
| 251 base::FilePath GetSanitizedFileName(const base::string16& name); | 261 base::FilePath GetSanitizedFileName(const base::string16& name); |
| 252 | 262 |
| 253 } // namespace internals | 263 } // namespace internals |
| 254 | 264 |
| 255 } // namespace web_app | 265 } // namespace web_app |
| 256 | 266 |
| 257 #endif // CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_H_ | 267 #endif // CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_H_ |
| OLD | NEW |