1 // Copyright (c) 2012 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_UI_CHROME_PAGES_H_
6 #define CHROME_BROWSER_UI_CHROME_PAGES_H_
7 
8 #include <stdint.h>
9 
10 #include <string>
11 
12 #include "build/build_config.h"
13 #include "components/content_settings/core/common/content_settings_types.h"
14 #include "components/services/app_service/public/mojom/types.mojom.h"
15 #include "url/gurl.h"
16 
17 #if !defined(OS_ANDROID)
18 #include "chrome/browser/signin/signin_promo.h"
19 #endif
20 
21 #if defined(OS_CHROMEOS)
22 #include "chrome/browser/chromeos/printing/print_management/print_management_uma.h"
23 #include "chrome/browser/ui/webui/settings/chromeos/app_management/app_management_uma.h"
24 #endif
25 
26 class Browser;
27 class Profile;
28 
29 namespace chrome {
30 
31 // Sources of requests to show the help tab.
32 enum HelpSource {
33   // Keyboard accelerators.
34   HELP_SOURCE_KEYBOARD,
35 
36   // Menus (e.g. app menu or Chrome OS system menu).
37   HELP_SOURCE_MENU,
38 
39   // WebUI (the "About" page).
40   HELP_SOURCE_WEBUI,
41 
42 #if defined(OS_CHROMEOS)
43   // WebUI (the OS "About" page).
44   HELP_SOURCE_WEBUI_CHROME_OS,
45 #endif
46 };
47 
48 // Sources of feedback requests.
49 //
50 // WARNING: The below enum MUST never be renamed, modified or reordered, as
51 // they're written to logs. You can only insert a new element immediately
52 // before the last.
53 enum FeedbackSource {
54   kFeedbackSourceArcApp = 0,
55   kFeedbackSourceAsh,
56   kFeedbackSourceBrowserCommand,
57   kFeedbackSourceMdSettingsAboutPage,
58   kFeedbackSourceOldSettingsAboutPage,
59   kFeedbackSourceProfileErrorDialog,
60   kFeedbackSourceSadTabPage,
61   kFeedbackSourceSupervisedUserInterstitial,
62   kFeedbackSourceAssistant,
63   kFeedbackSourceDesktopTabGroups,
64   kFeedbackSourceMediaApp,
65   kFeedbackSourceHelpApp,
66   kFeedbackSourceKaleidoscope,
67   kFeedbackSourceNetworkHealthPage,
68   kFeedbackSourceTabSearch,
69   kFeedbackSourceCameraApp,
70   kFeedbackSourceCaptureMode,
71 
72   // Must be last.
73   kFeedbackSourceCount,
74 };
75 
76 void ShowBookmarkManager(Browser* browser);
77 void ShowBookmarkManagerForNode(Browser* browser, int64_t node_id);
78 void ShowHistory(Browser* browser);
79 void ShowDownloads(Browser* browser);
80 void ShowExtensions(Browser* browser,
81                     const std::string& extension_to_highlight);
82 
83 // ShowFeedbackPage() uses |browser| to determine the URL of the current tab.
84 // |browser| should be NULL if there are no currently open browser windows.
85 void ShowFeedbackPage(const Browser* browser,
86                       FeedbackSource source,
87                       const std::string& description_template,
88                       const std::string& description_placeholder_text,
89                       const std::string& category_tag,
90                       const std::string& extra_diagnostics);
91 
92 // Displays the Feedback ui.
93 void ShowFeedbackPage(const GURL& page_url,
94                       Profile* profile,
95                       FeedbackSource source,
96                       const std::string& description_template,
97                       const std::string& description_placeholder_text,
98                       const std::string& category_tag,
99                       const std::string& extra_diagnostics);
100 
101 void ShowHelp(Browser* browser, HelpSource source);
102 void ShowHelpForProfile(Profile* profile, HelpSource source);
103 void LaunchReleaseNotes(Profile* profile, apps::mojom::LaunchSource source);
104 void ShowBetaForum(Browser* browser);
105 void ShowPolicy(Browser* browser);
106 void ShowSlow(Browser* browser);
107 
108 // Constructs a settings GURL for the specified |sub_page|.
109 GURL GetSettingsUrl(const std::string& sub_page);
110 
111 // Returns true if |browser| is a trusted popup window containing a page with
112 // matching |scheme| (or any trusted popup if |scheme| is empty).
113 bool IsTrustedPopupWindowWithScheme(const Browser* browser,
114                                     const std::string& scheme);
115 
116 // Various things that open in a settings UI.
117 // NOTE: For Chrome OS settings, use SettingsWindowManager::ShowOSSettings().
118 void ShowSettings(Browser* browser);
119 void ShowSettingsSubPage(Browser* browser, const std::string& sub_page);
120 void ShowSettingsSubPageForProfile(Profile* profile,
121                                    const std::string& sub_page);
122 void ShowContentSettingsExceptions(Browser* browser,
123                                    ContentSettingsType content_settings_type);
124 void ShowContentSettingsExceptionsForProfile(
125     Profile* profile,
126     ContentSettingsType content_settings_type);
127 
128 void ShowSiteSettings(Profile* profile, const GURL& url);
129 void ShowSiteSettings(Browser* browser, const GURL& url);
130 
131 void ShowContentSettings(Browser* browser,
132                          ContentSettingsType content_settings_type);
133 void ShowSettingsSubPageInTabbedBrowser(Browser* browser,
134                                         const std::string& sub_page);
135 void ShowClearBrowsingDataDialog(Browser* browser);
136 void ShowPasswordManager(Browser* browser);
137 void ShowPasswordCheck(Browser* browser);
138 void ShowSafeBrowsingEnhancedProtection(Browser* browser);
139 void ShowImportDialog(Browser* browser);
140 void ShowAboutChrome(Browser* browser);
141 void ShowSearchEngineSettings(Browser* browser);
142 
143 #if defined(OS_CHROMEOS)
144 // Shows the enterprise management info page in a browser tab.
145 void ShowEnterpriseManagementPageInTabbedBrowser(Browser* browser);
146 
147 // Constructs an OS settings GURL for the specified |sub_page|.
148 GURL GetOSSettingsUrl(const std::string& sub_page);
149 
150 void ShowAppManagementPage(Profile* profile,
151                            const std::string& app_id,
152                            AppManagementEntryPoint entry_point);
153 
154 void ShowPrintManagementApp(Profile* profile,
155                             PrintManagementAppEntryPoint entry_point);
156 
157 void ShowConnectivityDiagnosticsApp(Profile* profile);
158 #endif
159 
160 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS)
161 // Initiates signin in a new browser tab.
162 void ShowBrowserSignin(Browser* browser,
163                        signin_metrics::AccessPoint access_point);
164 
165 // If the user is already signed in, shows the "Signin" portion of Settings,
166 // otherwise initiates signin in a new browser tab.
167 void ShowBrowserSigninOrSettings(Browser* browser,
168                                  signin_metrics::AccessPoint access_point);
169 #endif
170 
171 }  // namespace chrome
172 
173 #endif  // CHROME_BROWSER_UI_CHROME_PAGES_H_
174