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() { ...@@ -66,83 +66,52 @@ cr.define('settings', function() {
*/ */
let pageVisibility; 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
// "if not chromeos" and "if chromeos" in two completely separate blocks // to work around closure compiler.
// to work around closure compiler. // <if expr="not chromeos">
// <if expr="not chromeos"> pageVisibility = {
pageVisibility = { autofill: !isGuest,
autofill: false, people: !isGuest,
people: false, onStartup: !isGuest,
onStartup: false, reset: !isGuest,
reset: false, appearance: !isGuest,
appearance: false, defaultBrowser: !isGuest,
defaultBrowser: false, advancedSettings: !isGuest,
advancedSettings: false, extensions: !isGuest,
extensions: false, };
}; // </if>
// </if> // <if expr="chromeos">
// <if expr="chromeos"> const showOS = loadTimeData.getBoolean('showOSSettings');
pageVisibility = { const showBrowser = loadTimeData.getBoolean('showBrowserSettings');
internet: showOSSettings, pageVisibility = {
bluetooth: showOSSettings, internet: showOS,
multidevice: false, bluetooth: showOS,
autofill: false, multidevice: showOS && !isGuest,
people: false, autofill: showBrowser && !isGuest,
onStartup: false, people: !isGuest,
reset: false, onStartup: !isGuest,
appearance: { reset: !isGuest,
setWallpaper: false, appearance: {
setTheme: false, setWallpaper: showOS && !isGuest,
homeButton: false, setTheme: showBrowser && !isGuest,
bookmarksBar: false, homeButton: showBrowser && !isGuest,
pageZoom: false, bookmarksBar: showBrowser && !isGuest,
}, pageZoom: showBrowser && !isGuest,
device: showOSSettings, },
advancedSettings: true, device: showOS,
privacy: { advancedSettings: true,
searchPrediction: false, privacy: {
networkPrediction: false, searchPrediction: !isGuest,
}, networkPrediction: !isGuest,
downloads: { },
googleDrive: false, downloads: {
}, googleDrive: !isGuest,
extensions: false, },
}; extensions: showBrowser && !isGuest,
// </if> };
} else { // </if>
// 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>
}
return {pageVisibility: pageVisibility}; return {pageVisibility: pageVisibility};
}); });
...@@ -71,6 +71,7 @@ OSSettingsUI::OSSettingsUI(content::WebUI* web_ui) ...@@ -71,6 +71,7 @@ OSSettingsUI::OSSettingsUI(content::WebUI* web_ui)
// TODO(jamescook): Remove after basic_page.html is forked for OS settings. // TODO(jamescook): Remove after basic_page.html is forked for OS settings.
html_source->AddBoolean("showOSSettings", true); html_source->AddBoolean("showOSSettings", true);
html_source->AddBoolean("showBrowserSettings", false);
#if BUILDFLAG(OPTIMIZE_WEBUI) #if BUILDFLAG(OPTIMIZE_WEBUI)
std::vector<std::string> exclude_from_gzip; std::vector<std::string> exclude_from_gzip;
......
...@@ -290,6 +290,7 @@ SettingsUI::SettingsUI(content::WebUI* web_ui) ...@@ -290,6 +290,7 @@ SettingsUI::SettingsUI(content::WebUI* web_ui)
#else #else
html_source->AddBoolean("showOSSettings", false); html_source->AddBoolean("showOSSettings", false);
#endif #endif
html_source->AddBoolean("showBrowserSettings", true);
AddSettingsPageUIHandler( AddSettingsPageUIHandler(
base::WrapUnique(AboutHandler::Create(html_source, profile))); 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