Commit 79782f30 authored by Joe Mason's avatar Joe Mason Committed by Commit Bot

Load the Chrome Cleaner partner logo SVG with GetRawDataResource.

The logo now has a title attr in it for screen readers. But when it's set as
the background of a <span>, or as an <img> src, screen readers don't look at
the tags inside. For the screen reader to view the tag it seems the <svg>
element must be part of the DOM tree. So after the <svg> element is loaded from
a resource, add it directly to the page.

R=hcarmona@chromium.org

Bug: 767130
Change-Id: I1de73057ba59df114fdb142baab9fc66f210995f
Reviewed-on: https://chromium-review.googlesource.com/c/1370833Reviewed-by: default avatarHector Carmona <hcarmona@chromium.org>
Commit-Queue: Joe Mason <joenotcharles@google.com>
Cr-Commit-Position: refs/heads/master@{#615514}
parent cd06525f
...@@ -35,9 +35,9 @@ ...@@ -35,9 +35,9 @@
width: 100%; width: 100%;
} }
/* Used by |chromeCleanupPoweredByHTML| */ /* Apply a fixed height to the <svg> tag inside #powered-by-logo.
#powered-by-logo { Used by |chromeCleanupPoweredByHTML|. */
content: url(chrome://settings/partner-logo.svg); #powered-by-logo > svg {
height: 22px; height: 22px;
} }
......
...@@ -83,6 +83,10 @@ ...@@ -83,6 +83,10 @@
#if defined(GOOGLE_CHROME_BUILD) #if defined(GOOGLE_CHROME_BUILD)
#include "base/metrics/field_trial_params.h" #include "base/metrics/field_trial_params.h"
#include "base/strings/strcat.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/grit/chrome_unscaled_resources.h"
#include "ui/base/resource/resource_bundle.h"
#endif #endif
#endif // defined(OS_WIN) #endif // defined(OS_WIN)
...@@ -991,9 +995,18 @@ void AddChromeCleanupStrings(content::WebUIDataSource* html_source) { ...@@ -991,9 +995,18 @@ void AddChromeCleanupStrings(content::WebUIDataSource* html_source) {
.spec(); .spec();
html_source->AddString("chromeCleanupLearnMoreUrl", cleanup_learn_more_url); html_source->AddString("chromeCleanupLearnMoreUrl", cleanup_learn_more_url);
// The "powered by" footer contains an HTML fragment with the SVG logo of the
// partner. The logo is added directly to the DOM, rather than as an <img>
// src, to make sure that screen readers can find accessibility tags inside
// the SVG.
const std::string powered_by_element =
base::StrCat({"<span id='powered-by-logo'>",
ui::ResourceBundle::GetSharedInstance().GetRawDataResource(
IDR_CHROME_CLEANUP_PARTNER),
"</span>"});
const base::string16 powered_by_html = const base::string16 powered_by_html =
l10n_util::GetStringFUTF16(IDS_SETTINGS_RESET_CLEANUP_FOOTER_POWERED_BY, l10n_util::GetStringFUTF16(IDS_SETTINGS_RESET_CLEANUP_FOOTER_POWERED_BY,
L"<span id='powered-by-logo'></span>"); base::UTF8ToUTF16(powered_by_element));
html_source->AddString("chromeCleanupPoweredByHtml", powered_by_html); html_source->AddString("chromeCleanupPoweredByHtml", powered_by_html);
const base::string16 cleanup_details_explanation = const base::string16 cleanup_details_explanation =
......
...@@ -62,7 +62,6 @@ ...@@ -62,7 +62,6 @@
#include "chrome/browser/conflicts/incompatible_applications_updater_win.h" #include "chrome/browser/conflicts/incompatible_applications_updater_win.h"
#include "chrome/browser/conflicts/token_util_win.h" #include "chrome/browser/conflicts/token_util_win.h"
#include "chrome/browser/ui/webui/settings/incompatible_applications_handler_win.h" #include "chrome/browser/ui/webui/settings/incompatible_applications_handler_win.h"
#include "chrome/grit/chrome_unscaled_resources.h"
#endif #endif
#endif // defined(OS_WIN) #endif // defined(OS_WIN)
...@@ -248,13 +247,6 @@ MdSettingsUI::MdSettingsUI(content::WebUI* web_ui) ...@@ -248,13 +247,6 @@ MdSettingsUI::MdSettingsUI(content::WebUI* web_ui)
#if defined(OS_WIN) #if defined(OS_WIN)
AddSettingsPageUIHandler(std::make_unique<ChromeCleanupHandler>(profile)); AddSettingsPageUIHandler(std::make_unique<ChromeCleanupHandler>(profile));
#if defined(GOOGLE_CHROME_BUILD)
html_source->AddResourcePath("partner-logo.svg", IDR_CHROME_CLEANUP_PARTNER);
#if BUILDFLAG(OPTIMIZE_WEBUI)
exclude_from_gzip.push_back("partner-logo.svg");
#endif
#endif // defined(GOOGLE_CHROME_BUILD)
#endif // defined(OS_WIN) #endif // defined(OS_WIN)
#if defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD) #if defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD)
......
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