blob: 9ecb837ce6fb06ecd991ec9281598a900b673a6c [file] [log] [blame]
Alexey Baskakovd05bb012019-03-27 07:06:171// 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 Baskakovd05bb012019-03-27 07:06:1710#include "url/gurl.h"
11
12namespace web_app {
13
Alexey Baskakov031895272019-07-18 08:19:3314enum class ExternalInstallSource;
Alexey Baskakovd05bb012019-03-27 07:06:1715enum class LaunchContainer;
16
17struct InstallOptions {
Alexey Baskakovd05bb012019-03-27 07:06:1718 InstallOptions(const GURL& url,
19 LaunchContainer launch_container,
Alexey Baskakov031895272019-07-18 08:19:3320 ExternalInstallSource install_source);
Alexey Baskakovd05bb012019-03-27 07:06:1721 ~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 Baskakovb51f32aa2019-07-18 06:54:5929 LaunchContainer launch_container;
Alexey Baskakov031895272019-07-18 08:19:3330 ExternalInstallSource install_source;
Alexey Baskakovd05bb012019-03-27 07:06:1731
Giovanni Ortuño Urquidie22f2e12019-04-01 02:43:5132 // 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 Baskakovd05bb012019-03-27 07:06:1749
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 Lama04e05922019-06-27 06:06:1164 bool force_reinstall = false;
Giovanni Ortuño Urquidic7e719b2019-04-03 01:33:3065
Giovanni Ortuño Urquidi68bd2a52019-04-18 12:15:2466 // 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 Urquidib6f4c5e02019-04-16 04:57:5669
Giovanni Ortuño Urquidic7e719b2019-04-03 01:33:3070 // 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 Urquidib6f4c5e02019-04-16 04:57:5676
77 // Whether we should try to reinstall the app if there is a placeholder for
78 // it.
79 bool reinstall_placeholder = false;
Alexey Baskakovd05bb012019-03-27 07:06:1780};
81
82std::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_