1 // Copyright 2018 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef CHROME_BROWSER_WEB_APPLICATIONS_COMPONENTS_WEB_APP_SHORTCUT_WIN_H_ 6 #define CHROME_BROWSER_WEB_APPLICATIONS_COMPONENTS_WEB_APP_SHORTCUT_WIN_H_ 7 8 #include "chrome/browser/web_applications/components/web_app_shortcut.h" 9 10 #include "base/win/windows_types.h" 11 12 namespace web_app { 13 14 base::FilePath GetChromeProxyPath(); 15 16 namespace internals { 17 18 // Sanitizes |name| and returns a version of it that is safe to use as an 19 // on-disk file name. 20 base::FilePath GetSanitizedFileName(const base::string16& name); 21 22 // Returns the Windows user-level shortcut paths that are specified in 23 // |creation_locations|. 24 std::vector<base::FilePath> GetShortcutPaths( 25 const ShortcutLocations& creation_locations); 26 27 // Saves |image| to |icon_file| if the file is outdated. Returns true if 28 // icon_file is up to date or successfully updated. 29 // If |refresh_shell_icon_cache| is true, the shell's icon cache will be 30 // refreshed, ensuring the correct icon is displayed, but causing a flicker. 31 // Refreshing the icon cache is not necessary on shortcut creation as the shell 32 // will be notified when the shortcut is created. 33 // Creates the parent dir of icon_file, if it doesn't exist. 34 bool CheckAndSaveIcon(const base::FilePath& icon_file, 35 const gfx::ImageFamily& image, 36 bool refresh_shell_icon_cache); 37 38 // Finds shortcuts in |shortcut_path| that match profile for |profile_path| and 39 // extension with title |shortcut_name|. 40 // If |shortcut_name| is empty, finds all shortcuts matching |profile_path|. 41 std::vector<base::FilePath> FindAppShortcutsByProfileAndTitle( 42 const base::FilePath& shortcut_path, 43 const base::FilePath& profile_path, 44 const base::string16& shortcut_name); 45 46 base::FilePath GetIconFilePath(const base::FilePath& web_app_path, 47 const base::string16& title); 48 49 void OnShortcutInfoLoadedForSetRelaunchDetails( 50 HWND hwnd, 51 std::unique_ptr<ShortcutInfo> shortcut_info); 52 53 } // namespace internals 54 55 } // namespace web_app 56 57 #endif // CHROME_BROWSER_WEB_APPLICATIONS_COMPONENTS_WEB_APP_SHORTCUT_WIN_H_ 58