| 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 // extension. | 165 // extension. |
| 166 void DeleteAllShortcuts(Profile* profile, const extensions::Extension* app); | 166 void DeleteAllShortcuts(Profile* profile, const extensions::Extension* app); |
| 167 | 167 |
| 168 // Updates shortcuts for web application based on given shortcut data. This | 168 // Updates shortcuts for web application based on given shortcut data. This |
| 169 // refreshes existing shortcuts and their icons, but does not create new ones. | 169 // refreshes existing shortcuts and their icons, but does not create new ones. |
| 170 // |old_app_title| contains the title of the app prior to this update. | 170 // |old_app_title| contains the title of the app prior to this update. |
| 171 void UpdateAllShortcuts(const base::string16& old_app_title, | 171 void UpdateAllShortcuts(const base::string16& old_app_title, |
| 172 Profile* profile, | 172 Profile* profile, |
| 173 const extensions::Extension* app); | 173 const extensions::Extension* app); |
| 174 | 174 |
| 175 // Updates shortcuts for all apps in this profile. |
| 176 void UpdateShortcutsForAllApps(Profile* profile); |
| 177 |
| 175 // Returns true if given url is a valid web app url. | 178 // Returns true if given url is a valid web app url. |
| 176 bool IsValidUrl(const GURL& url); | 179 bool IsValidUrl(const GURL& url); |
| 177 | 180 |
| 178 #if defined(TOOLKIT_VIEWS) | 181 #if defined(TOOLKIT_VIEWS) |
| 179 // Extracts icons info from web app data. Take only square shaped icons and | 182 // Extracts icons info from web app data. Take only square shaped icons and |
| 180 // sort them from smallest to largest. | 183 // sort them from smallest to largest. |
| 181 typedef std::vector<WebApplicationInfo::IconInfo> IconInfoList; | 184 typedef std::vector<WebApplicationInfo::IconInfo> IconInfoList; |
| 182 void GetIconsInfo(const WebApplicationInfo& app_info, IconInfoList* icons); | 185 void GetIconsInfo(const WebApplicationInfo& app_info, IconInfoList* icons); |
| 183 #endif | 186 #endif |
| 184 | 187 |
| 185 #if defined(OS_LINUX) | 188 #if defined(OS_LINUX) |
| 186 // Windows that correspond to web apps need to have a deterministic (and | 189 // Windows that correspond to web apps need to have a deterministic (and |
| 187 // different) WMClass than normal chrome windows so the window manager groups | 190 // different) WMClass than normal chrome windows so the window manager groups |
| 188 // them as a separate application. | 191 // them as a separate application. |
| 189 std::string GetWMClassFromAppName(std::string app_name); | 192 std::string GetWMClassFromAppName(std::string app_name); |
| 190 #endif | 193 #endif |
| 191 | 194 |
| 192 namespace internals { | 195 namespace internals { |
| 193 | 196 |
| 197 typedef base::Callback<void(Profile*, const extensions::Extension*)> |
| 198 ShortcutOperationCallback; |
| 199 |
| 200 // Resolves |profile_path| and |app_id| into Profile* and Extension*. |
| 201 void CallForProfileAndAppId( |
| 202 const base::FilePath& profile_path, |
| 203 const std::string app_id, |
| 204 const ShortcutOperationCallback& callback); |
| 205 |
| 194 #if defined(OS_WIN) | 206 #if defined(OS_WIN) |
| 195 // Returns the Windows user-level shortcut paths that are specified in | 207 // Returns the Windows user-level shortcut paths that are specified in |
| 196 // |creation_locations|. | 208 // |creation_locations|. |
| 197 std::vector<base::FilePath> GetShortcutPaths( | 209 std::vector<base::FilePath> GetShortcutPaths( |
| 198 const ShortcutLocations& creation_locations); | 210 const ShortcutLocations& creation_locations); |
| 199 #endif | 211 #endif |
| 200 | 212 |
| 201 // Creates a shortcut. Must be called on the file thread. This is used to | 213 // Creates a shortcut. Must be called on the file thread. This is used to |
| 202 // implement CreateShortcuts() above, and can also be used directly from the | 214 // implement CreateShortcuts() above, and can also be used directly from the |
| 203 // file thread. |shortcut_info| contains info about the shortcut to create, and | 215 // file thread. |shortcut_info| contains info about the shortcut to create, and |
| (...skipping 27 matching lines...) Expand all Loading... |
| 231 void UpdatePlatformShortcuts( | 243 void UpdatePlatformShortcuts( |
| 232 const base::FilePath& shortcut_data_path, | 244 const base::FilePath& shortcut_data_path, |
| 233 const base::string16& old_app_title, | 245 const base::string16& old_app_title, |
| 234 const ShortcutInfo& shortcut_info, | 246 const ShortcutInfo& shortcut_info, |
| 235 const extensions::FileHandlersInfo& file_handlers_info); | 247 const extensions::FileHandlersInfo& file_handlers_info); |
| 236 | 248 |
| 237 // Delete all the shortcuts for an entire profile. | 249 // Delete all the shortcuts for an entire profile. |
| 238 // This is executed on the FILE thread. | 250 // This is executed on the FILE thread. |
| 239 void DeleteAllShortcutsForProfile(const base::FilePath& profile_path); | 251 void DeleteAllShortcutsForProfile(const base::FilePath& profile_path); |
| 240 | 252 |
| 253 // Checks all shortcuts for a profile and deletes/updates them as necessary. |
| 254 void UpdateShortcutsForAllAppsForProfile(const base::FilePath& profile_path, |
| 255 const std::set<std::string>& app_ids); |
| 256 |
| 241 // 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 |
| 242 // on-disk file name . | 258 // on-disk file name . |
| 243 base::FilePath GetSanitizedFileName(const base::string16& name); | 259 base::FilePath GetSanitizedFileName(const base::string16& name); |
| 244 | 260 |
| 245 } // namespace internals | 261 } // namespace internals |
| 246 | 262 |
| 247 } // namespace web_app | 263 } // namespace web_app |
| 248 | 264 |
| 249 #endif // CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_H_ | 265 #endif // CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_H_ |
| OLD | NEW |