Commit ed8a203d authored by James Cook's avatar James Cook Committed by Commit Bot

CrOS SplitSettings: Hide browser sections in chrome://os-settings/

Use pageVisibility to hide sections like autofill, show bookmarks bar,
etc.

Bug: 950007
Change-Id: I871322a3eca51eb6995fa4ee304461c9f8bd0f35
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1575032Reviewed-by: default avatarDan Beam <dbeam@chromium.org>
Commit-Queue: James Cook <jamescook@chromium.org>
Cr-Commit-Position: refs/heads/master@{#652856}
parent 7b459a69
......@@ -66,83 +66,52 @@ cr.define('settings', function() {
*/
let pageVisibility;
const showOSSettings = loadTimeData.getBoolean('showOSSettings');
const isGuest = loadTimeData.getBoolean('isGuest');
if (loadTimeData.getBoolean('isGuest')) {
// "if not chromeos" and "if chromeos" in two completely separate blocks
// to work around closure compiler.
// <if expr="not chromeos">
pageVisibility = {
autofill: false,
people: false,
onStartup: false,
reset: false,
appearance: false,
defaultBrowser: false,
advancedSettings: false,
extensions: false,
};
// </if>
// <if expr="chromeos">
pageVisibility = {
internet: showOSSettings,
bluetooth: showOSSettings,
multidevice: false,
autofill: false,
people: false,
onStartup: false,
reset: false,
appearance: {
setWallpaper: false,
setTheme: false,
homeButton: false,
bookmarksBar: false,
pageZoom: false,
},
device: showOSSettings,
advancedSettings: true,
privacy: {
searchPrediction: false,
networkPrediction: false,
},
downloads: {
googleDrive: false,
},
extensions: false,
};
// </if>
} else {
// All pages are visible when not in chromeos. Since polymer only notifies
// after a property is set.
// <if expr="chromeos">
pageVisibility = {
internet: showOSSettings,
bluetooth: showOSSettings,
multidevice: showOSSettings,
autofill: true,
people: true,
onStartup: true,
reset: true,
appearance: {
setWallpaper: true,
setTheme: true,
homeButton: true,
bookmarksBar: true,
pageZoom: true,
},
device: showOSSettings,
advancedSettings: true,
privacy: {
searchPrediction: true,
networkPrediction: true,
},
downloads: {
googleDrive: true,
},
extensions: true,
};
// </if>
}
// "if not chromeos" and "if chromeos" in two completely separate blocks
// to work around closure compiler.
// <if expr="not chromeos">
pageVisibility = {
autofill: !isGuest,
people: !isGuest,
onStartup: !isGuest,
reset: !isGuest,
appearance: !isGuest,
defaultBrowser: !isGuest,
advancedSettings: !isGuest,
extensions: !isGuest,
};
// </if>
// <if expr="chromeos">
const showOS = loadTimeData.getBoolean('showOSSettings');
const showBrowser = loadTimeData.getBoolean('showBrowserSettings');
pageVisibility = {
internet: showOS,
bluetooth: showOS,
multidevice: showOS && !isGuest,
autofill: showBrowser && !isGuest,
people: !isGuest,
onStartup: !isGuest,
reset: !isGuest,
appearance: {
setWallpaper: showOS && !isGuest,
setTheme: showBrowser && !isGuest,
homeButton: showBrowser && !isGuest,
bookmarksBar: showBrowser && !isGuest,
pageZoom: showBrowser && !isGuest,
},
device: showOS,
advancedSettings: true,
privacy: {
searchPrediction: !isGuest,
networkPrediction: !isGuest,
},
downloads: {
googleDrive: !isGuest,
},
extensions: showBrowser && !isGuest,
};
// </if>
return {pageVisibility: pageVisibility};
});
......@@ -71,6 +71,7 @@ OSSettingsUI::OSSettingsUI(content::WebUI* web_ui)
// TODO(jamescook): Remove after basic_page.html is forked for OS settings.
html_source->AddBoolean("showOSSettings", true);
html_source->AddBoolean("showBrowserSettings", false);
#if BUILDFLAG(OPTIMIZE_WEBUI)
std::vector<std::string> exclude_from_gzip;
......
......@@ -290,6 +290,7 @@ SettingsUI::SettingsUI(content::WebUI* web_ui)
#else
html_source->AddBoolean("showOSSettings", false);
#endif
html_source->AddBoolean("showBrowserSettings", true);
AddSettingsPageUIHandler(
base::WrapUnique(AboutHandler::Create(html_source, profile)));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment