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: false, autofill: !isGuest,
people: false, people: !isGuest,
onStartup: false, onStartup: !isGuest,
reset: false, reset: !isGuest,
appearance: false, appearance: !isGuest,
defaultBrowser: false, defaultBrowser: !isGuest,
advancedSettings: false, advancedSettings: !isGuest,
extensions: false, extensions: !isGuest,
}; };
// </if> // </if>
// <if expr="chromeos"> // <if expr="chromeos">
const showOS = loadTimeData.getBoolean('showOSSettings');
const showBrowser = loadTimeData.getBoolean('showBrowserSettings');
pageVisibility = { pageVisibility = {
internet: showOSSettings, internet: showOS,
bluetooth: showOSSettings, bluetooth: showOS,
multidevice: false, multidevice: showOS && !isGuest,
autofill: false, autofill: showBrowser && !isGuest,
people: false, people: !isGuest,
onStartup: false, onStartup: !isGuest,
reset: false, reset: !isGuest,
appearance: { appearance: {
setWallpaper: false, setWallpaper: showOS && !isGuest,
setTheme: false, setTheme: showBrowser && !isGuest,
homeButton: false, homeButton: showBrowser && !isGuest,
bookmarksBar: false, bookmarksBar: showBrowser && !isGuest,
pageZoom: false, pageZoom: showBrowser && !isGuest,
}, },
device: showOSSettings, device: showOS,
advancedSettings: true, advancedSettings: true,
privacy: { privacy: {
searchPrediction: false, searchPrediction: !isGuest,
networkPrediction: false, networkPrediction: !isGuest,
}, },
downloads: { downloads: {
googleDrive: false, googleDrive: !isGuest,
}, },
extensions: false, extensions: showBrowser && !isGuest,
}; };
// </if> // </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>
}
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