blob: c3ba1eb9a9943a587f46bab47b622f309c722a8d [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
10#include "url/gurl.h"
11
12namespace web_app {
13
14enum class InstallSource;
15enum class LaunchContainer;
16
17struct InstallOptions {
18 InstallOptions(const GURL& url,
19 LaunchContainer launch_container,
20 InstallSource install_source);
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;
29 LaunchContainer launch_container;
30 InstallSource install_source;
31
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.
64 bool always_update = false;
Giovanni Ortuño Urquidic7e719b2019-04-03 01:33:3065
66 // Whether a placeholder app should be installed if we fail to retrieve the
67 // metadata for the app. A placeholder app uses:
68 // - The default Chrome App icon for the icon
69 // - |url| as the start_url
70 // - |url| as the app name
71 bool install_placeholder = false;
Alexey Baskakovd05bb012019-03-27 07:06:1772};
73
74std::ostream& operator<<(std::ostream& out,
75 const InstallOptions& install_options);
76
77} // namespace web_app
78
79#endif // CHROME_BROWSER_WEB_APPLICATIONS_COMPONENTS_INSTALL_OPTIONS_H_