Alexey Baskakov | d05bb01 | 2019-03-27 07:06:17 | [diff] [blame] | 1 | // Copyright 2019 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_INSTALL_OPTIONS_H_ |
| 6 | #define CHROME_BROWSER_WEB_APPLICATIONS_COMPONENTS_INSTALL_OPTIONS_H_ |
| 7 | |
| 8 | #include <iosfwd> |
| 9 | |
Alexey Baskakov | d05bb01 | 2019-03-27 07:06:17 | [diff] [blame] | 10 | #include "url/gurl.h" |
| 11 | |
| 12 | namespace web_app { |
| 13 | |
Alexey Baskakov | 03189527 | 2019-07-18 08:19:33 | [diff] [blame^] | 14 | enum class ExternalInstallSource; |
Alexey Baskakov | d05bb01 | 2019-03-27 07:06:17 | [diff] [blame] | 15 | enum class LaunchContainer; |
| 16 | |
| 17 | struct InstallOptions { |
Alexey Baskakov | d05bb01 | 2019-03-27 07:06:17 | [diff] [blame] | 18 | InstallOptions(const GURL& url, |
| 19 | LaunchContainer launch_container, |
Alexey Baskakov | 03189527 | 2019-07-18 08:19:33 | [diff] [blame^] | 20 | ExternalInstallSource install_source); |
Alexey Baskakov | d05bb01 | 2019-03-27 07:06:17 | [diff] [blame] | 21 | ~InstallOptions(); |
| 22 | InstallOptions(const InstallOptions& other); |
| 23 | InstallOptions(InstallOptions&& other); |
| 24 | InstallOptions& operator=(const InstallOptions& other); |
| 25 | |
| 26 | bool operator==(const InstallOptions& other) const; |
| 27 | |
| 28 | GURL url; |
Alexey Baskakov | b51f32aa | 2019-07-18 06:54:59 | [diff] [blame] | 29 | LaunchContainer launch_container; |
Alexey Baskakov | 03189527 | 2019-07-18 08:19:33 | [diff] [blame^] | 30 | ExternalInstallSource install_source; |
Alexey Baskakov | d05bb01 | 2019-03-27 07:06:17 | [diff] [blame] | 31 | |
Giovanni Ortuño Urquidi | e22f2e1 | 2019-04-01 02:43:51 | [diff] [blame] | 32 | // If true, a shortcut is added to the Applications folder on macOS, and Start |
| 33 | // Menu on Linux and Windows. On Chrome OS, all installed apps show up in the |
| 34 | // app list, so there is no need to do anything there. If false, we skip |
| 35 | // adding a shortcut to desktop as well, regardless of the value of |
| 36 | // |add_to_desktop|. |
| 37 | // TODO(ortuno): Make adding a shortcut to the applications menu independent |
| 38 | // from adding a shortcut to desktop. |
| 39 | bool add_to_applications_menu = true; |
| 40 | |
| 41 | // If true, a shortcut is added to the desktop on Linux and Windows. Has no |
| 42 | // effect on macOS and Chrome OS. |
| 43 | bool add_to_desktop = true; |
| 44 | |
| 45 | // If true, a shortcut is added to the "quick launch bar" of the OS: the Shelf |
| 46 | // for Chrome OS, the Dock for macOS, and the Quick Launch Bar or Taskbar on |
| 47 | // Windows. Currently this only works on Chrome OS. |
| 48 | bool add_to_quick_launch_bar = true; |
Alexey Baskakov | d05bb01 | 2019-03-27 07:06:17 | [diff] [blame] | 49 | |
| 50 | // Whether the app should be reinstalled even if the user has previously |
| 51 | // uninstalled it. |
| 52 | bool override_previous_user_uninstall = false; |
| 53 | |
| 54 | // This must only be used by pre-installed default or system apps that are |
| 55 | // valid PWAs if loading the real service worker is too costly to verify |
| 56 | // programmatically. |
| 57 | bool bypass_service_worker_check = false; |
| 58 | |
| 59 | // This should be used for installing all default apps so that good metadata |
| 60 | // is ensured. |
| 61 | bool require_manifest = false; |
| 62 | |
| 63 | // Whether the app should be reinstalled even if it is already installed. |
Christopher Lam | a04e0592 | 2019-06-27 06:06:11 | [diff] [blame] | 64 | bool force_reinstall = false; |
Giovanni Ortuño Urquidi | c7e719b | 2019-04-03 01:33:30 | [diff] [blame] | 65 | |
Giovanni Ortuño Urquidi | 68bd2a5 | 2019-04-18 12:15:24 | [diff] [blame] | 66 | // Whether we should wait for all app windows being closed before reinstalling |
| 67 | // the placeholder. |
| 68 | bool wait_for_windows_closed = false; |
Giovanni Ortuño Urquidi | b6f4c5e0 | 2019-04-16 04:57:56 | [diff] [blame] | 69 | |
Giovanni Ortuño Urquidi | c7e719b | 2019-04-03 01:33:30 | [diff] [blame] | 70 | // Whether a placeholder app should be installed if we fail to retrieve the |
| 71 | // metadata for the app. A placeholder app uses: |
| 72 | // - The default Chrome App icon for the icon |
| 73 | // - |url| as the start_url |
| 74 | // - |url| as the app name |
| 75 | bool install_placeholder = false; |
Giovanni Ortuño Urquidi | b6f4c5e0 | 2019-04-16 04:57:56 | [diff] [blame] | 76 | |
| 77 | // Whether we should try to reinstall the app if there is a placeholder for |
| 78 | // it. |
| 79 | bool reinstall_placeholder = false; |
Alexey Baskakov | d05bb01 | 2019-03-27 07:06:17 | [diff] [blame] | 80 | }; |
| 81 | |
| 82 | std::ostream& operator<<(std::ostream& out, |
| 83 | const InstallOptions& install_options); |
| 84 | |
| 85 | } // namespace web_app |
| 86 | |
| 87 | #endif // CHROME_BROWSER_WEB_APPLICATIONS_COMPONENTS_INSTALL_OPTIONS_H_ |