blob: 9983f25c25af4dbbd5db7be1ae945d5fdcadc84b [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
Giovanni Ortuño Urquidi2d57e5b2019-04-16 07:10:4610#include "chrome/browser/web_applications/components/web_app_constants.h"
Alexey Baskakovd05bb012019-03-27 07:06:1711#include "url/gurl.h"
12
13namespace web_app {
14
15enum class InstallSource;
16enum class LaunchContainer;
17
18struct InstallOptions {
Giovanni Ortuño Urquidi2d57e5b2019-04-16 07:10:4619 InstallOptions();
Alexey Baskakovd05bb012019-03-27 07:06:1720 InstallOptions(const GURL& url,
21 LaunchContainer launch_container,
22 InstallSource install_source);
23 ~InstallOptions();
24 InstallOptions(const InstallOptions& other);
25 InstallOptions(InstallOptions&& other);
26 InstallOptions& operator=(const InstallOptions& other);
27
28 bool operator==(const InstallOptions& other) const;
29
30 GURL url;
Giovanni Ortuño Urquidi2d57e5b2019-04-16 07:10:4631 LaunchContainer launch_container = LaunchContainer::kTab;
Christopher Lam44ee1a82019-06-21 06:50:5632 InstallSource install_source = InstallSource::kInvalid;
Alexey Baskakovd05bb012019-03-27 07:06:1733
Giovanni Ortuño Urquidie22f2e12019-04-01 02:43:5134 // If true, a shortcut is added to the Applications folder on macOS, and Start
35 // Menu on Linux and Windows. On Chrome OS, all installed apps show up in the
36 // app list, so there is no need to do anything there. If false, we skip
37 // adding a shortcut to desktop as well, regardless of the value of
38 // |add_to_desktop|.
39 // TODO(ortuno): Make adding a shortcut to the applications menu independent
40 // from adding a shortcut to desktop.
41 bool add_to_applications_menu = true;
42
43 // If true, a shortcut is added to the desktop on Linux and Windows. Has no
44 // effect on macOS and Chrome OS.
45 bool add_to_desktop = true;
46
47 // If true, a shortcut is added to the "quick launch bar" of the OS: the Shelf
48 // for Chrome OS, the Dock for macOS, and the Quick Launch Bar or Taskbar on
49 // Windows. Currently this only works on Chrome OS.
50 bool add_to_quick_launch_bar = true;
Alexey Baskakovd05bb012019-03-27 07:06:1751
52 // Whether the app should be reinstalled even if the user has previously
53 // uninstalled it.
54 bool override_previous_user_uninstall = false;
55
56 // This must only be used by pre-installed default or system apps that are
57 // valid PWAs if loading the real service worker is too costly to verify
58 // programmatically.
59 bool bypass_service_worker_check = false;
60
61 // This should be used for installing all default apps so that good metadata
62 // is ensured.
63 bool require_manifest = false;
64
65 // Whether the app should be reinstalled even if it is already installed.
Christopher Lama04e05922019-06-27 06:06:1166 bool force_reinstall = false;
Giovanni Ortuño Urquidic7e719b2019-04-03 01:33:3067
Giovanni Ortuño Urquidi68bd2a52019-04-18 12:15:2468 // Whether we should wait for all app windows being closed before reinstalling
69 // the placeholder.
70 bool wait_for_windows_closed = false;
Giovanni Ortuño Urquidib6f4c5e02019-04-16 04:57:5671
Giovanni Ortuño Urquidic7e719b2019-04-03 01:33:3072 // Whether a placeholder app should be installed if we fail to retrieve the
73 // metadata for the app. A placeholder app uses:
74 // - The default Chrome App icon for the icon
75 // - |url| as the start_url
76 // - |url| as the app name
77 bool install_placeholder = false;
Giovanni Ortuño Urquidib6f4c5e02019-04-16 04:57:5678
79 // Whether we should try to reinstall the app if there is a placeholder for
80 // it.
81 bool reinstall_placeholder = false;
Alexey Baskakovd05bb012019-03-27 07:06:1782};
83
84std::ostream& operator<<(std::ostream& out,
85 const InstallOptions& install_options);
86
87} // namespace web_app
88
89#endif // CHROME_BROWSER_WEB_APPLICATIONS_COMPONENTS_INSTALL_OPTIONS_H_