Commit 019b6bf2 authored by proberge's avatar proberge Committed by Commit Bot

Always add the ChromeCleanupHandler to the settings WebUI.

Due to loadTimeData inconsistencies between refreshes, it's possible for
"chromeCleanupEnabled" to become true while no ChromeCleanupHandler is
present. 
To avoid showing a blank card or crashing in debug mode for edge cases,
always install the handler.

Also added some documentation to load_time_data.js to hopefully help
other developers avoid this issue.

Bug: 690020
Change-Id: Ifa8e0c0e78c2d6202e11fd378c74781b24401918
Reviewed-on: https://chromium-review.googlesource.com/565327Reviewed-by: default avatarTommy Li <tommycli@chromium.org>
Reviewed-by: default avatarMichael Giuffrida <michaelpg@chromium.org>
Commit-Queue: proberge <proberge@chromium.org>
Cr-Commit-Position: refs/heads/master@{#485391}
parent bca4f583
...@@ -180,10 +180,11 @@ MdSettingsUI::MdSettingsUI(content::WebUI* web_ui, const GURL& url) ...@@ -180,10 +180,11 @@ MdSettingsUI::MdSettingsUI(content::WebUI* web_ui, const GURL& url)
html_source->AddString("hostname", url.host()); html_source->AddString("hostname", url.host());
#if defined(OS_WIN) #if defined(OS_WIN)
if (base::FeatureList::IsEnabled(safe_browsing::kInBrowserCleanerUIFeature) && if (base::FeatureList::IsEnabled(safe_browsing::kInBrowserCleanerUIFeature)) {
safe_browsing::ChromeCleanerController::ShouldShowCleanupInSettingsUI()) {
AddSettingsPageUIHandler(base::MakeUnique<ChromeCleanupHandler>(profile)); AddSettingsPageUIHandler(base::MakeUnique<ChromeCleanupHandler>(profile));
html_source->AddBoolean("chromeCleanupEnabled", true);
if (safe_browsing::ChromeCleanerController::ShouldShowCleanupInSettingsUI())
html_source->AddBoolean("chromeCleanupEnabled", true);
} }
#endif // defined(OS_WIN) #endif // defined(OS_WIN)
......
...@@ -8,6 +8,10 @@ ...@@ -8,6 +8,10 @@
* content has finished loading). This data includes both localized strings and * content has finished loading). This data includes both localized strings and
* any data that is important to have ready from a very early stage (e.g. things * any data that is important to have ready from a very early stage (e.g. things
* that must be displayed right away). * that must be displayed right away).
*
* Note that loadTimeData is not guaranteed to be consistent between page
* refreshes (https://crbug.com/740629) and should not contain values that might
* change if the page is re-opened later.
*/ */
/** @type {!LoadTimeData} */ var loadTimeData; /** @type {!LoadTimeData} */ var loadTimeData;
......
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