Commit bdb829e3 authored by Katie D's avatar Katie D Committed by Commit Bot

Reland "Adjustments to reader mode view page title on desktop."

This reverts commit ce64e25e.

A fix was made so the title does not change on iOS either.

Original change's description:
> Adjustments to reader mode view page title on desktop.
>
> Reader mode view page title now says "Loading..." instead of
> "Simplified view" on Desktop before the article title is populated.
>
> The article title is followed by "- Reader mode" to provide an
> indication to screen reader users that they are in a distilled page tab.
>
> Bug: 1016461
> Change-Id: Ie7ab1ab1e89090e182c4c556bd22878ee876b818
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2052487
> Commit-Queue: Katie Dektar <katie@chromium.org>
> Reviewed-by: Matthew Jones <mdjones@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#744120}

Change-Id: I363ada8dfedd60673e46d09d57bab75c88144fb7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2072124
Commit-Queue: Katie Dektar <katie@chromium.org>
Reviewed-by: default avatarMatthew Jones <mdjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#744368}
parent 93888160
...@@ -36,6 +36,11 @@ namespace { ...@@ -36,6 +36,11 @@ namespace {
const char* kSimpleArticlePath = "/dom_distiller/simple_article.html"; const char* kSimpleArticlePath = "/dom_distiller/simple_article.html";
const char* kOriginalArticleTitle = "Test Page Title"; const char* kOriginalArticleTitle = "Test Page Title";
#if defined(OS_ANDROID)
const char* kExpectedArticleTitle = "Test Page Title";
#else // Desktop. This test is in chrome/ and is not run on iOS.
const char* kExpectedArticleTitle = "Test Page Title - Reader Mode";
#endif // defined(OS_ANDROID)
std::unique_ptr<content::WebContents> NewContentsWithSameParamsAs( std::unique_ptr<content::WebContents> NewContentsWithSameParamsAs(
content::WebContents* source_web_contents) { content::WebContents* source_web_contents) {
...@@ -160,7 +165,7 @@ IN_PROC_BROWSER_TEST_F(DomDistillerTabUtilsBrowserTest, ...@@ -160,7 +165,7 @@ IN_PROC_BROWSER_TEST_F(DomDistillerTabUtilsBrowserTest,
EXPECT_NE(initial_web_contents, after_web_contents); EXPECT_NE(initial_web_contents, after_web_contents);
EXPECT_TRUE( EXPECT_TRUE(
after_web_contents->GetLastCommittedURL().SchemeIs(kDomDistillerScheme)); after_web_contents->GetLastCommittedURL().SchemeIs(kDomDistillerScheme));
EXPECT_EQ(kOriginalArticleTitle, GetPageTitle(after_web_contents)); EXPECT_EQ(kExpectedArticleTitle, GetPageTitle(after_web_contents));
} }
IN_PROC_BROWSER_TEST_F(DomDistillerTabUtilsBrowserTest, IN_PROC_BROWSER_TEST_F(DomDistillerTabUtilsBrowserTest,
...@@ -188,7 +193,7 @@ IN_PROC_BROWSER_TEST_F(DomDistillerTabUtilsBrowserTest, ...@@ -188,7 +193,7 @@ IN_PROC_BROWSER_TEST_F(DomDistillerTabUtilsBrowserTest,
// Verify the destination WebContents is showing distilled content. // Verify the destination WebContents is showing distilled content.
EXPECT_TRUE(destination_web_contents->GetLastCommittedURL().SchemeIs( EXPECT_TRUE(destination_web_contents->GetLastCommittedURL().SchemeIs(
kDomDistillerScheme)); kDomDistillerScheme));
EXPECT_EQ(kOriginalArticleTitle, GetPageTitle(destination_web_contents)); EXPECT_EQ(kExpectedArticleTitle, GetPageTitle(destination_web_contents));
content::WebContentsDestroyedWatcher destroyed_watcher( content::WebContentsDestroyedWatcher destroyed_watcher(
destination_web_contents); destination_web_contents);
......
...@@ -175,7 +175,13 @@ const std::string GetErrorPageJs() { ...@@ -175,7 +175,13 @@ const std::string GetErrorPageJs() {
} }
const std::string GetSetTitleJs(std::string title) { const std::string GetSetTitleJs(std::string title) {
#if defined(OS_ANDROID) || defined(OS_IOS)
base::Value value(title); base::Value value(title);
#else // Desktop
std::string suffix(
l10n_util::GetStringUTF8(IDS_DOM_DISTILLER_VIEWER_TITLE_SUFFIX));
base::Value value(title + " - " + suffix);
#endif
std::string output; std::string output;
base::JSONWriter::Write(value, &output); base::JSONWriter::Write(value, &output);
return "setTitle(" + output + ");"; return "setTitle(" + output + ");";
......
...@@ -31,9 +31,18 @@ ...@@ -31,9 +31,18 @@
<message name="IDS_DOM_DISTILLER_VIEWER_FAILED_TO_FIND_ARTICLE_CONTENT" desc="The text to show in place of reading list article content if the article is not found."> <message name="IDS_DOM_DISTILLER_VIEWER_FAILED_TO_FIND_ARTICLE_CONTENT" desc="The text to show in place of reading list article content if the article is not found.">
Could not find the requested article. Could not find the requested article.
</message> </message>
<if expr="is_android or is_ios">
<then>
<message name="IDS_DOM_DISTILLER_VIEWER_LOADING_TITLE" desc="The text to show in place of a reading list article title while the article is loading. Translation should match TC ID 7558334641404735182, 7078777000119799848, and 8486137854427127199."> <message name="IDS_DOM_DISTILLER_VIEWER_LOADING_TITLE" desc="The text to show in place of a reading list article title while the article is loading. Translation should match TC ID 7558334641404735182, 7078777000119799848, and 8486137854427127199.">
Simplified view Simplified view
</message> </message>
</then>
<else> <!-- Desktop -->
<message name="IDS_DOM_DISTILLER_VIEWER_LOADING_TITLE" desc="The text to show in place of a reading list article title while the article is loading.">
Loading...
</message>
</else>
</if>
<message name="IDS_DOM_DISTILLER_VIEWER_NO_DATA_CONTENT" desc="The text to show in place of reading list article content if there is no data found."> <message name="IDS_DOM_DISTILLER_VIEWER_NO_DATA_CONTENT" desc="The text to show in place of reading list article content if there is no data found.">
No data found. No data found.
</message> </message>
...@@ -49,5 +58,8 @@ ...@@ -49,5 +58,8 @@
<message name="IDS_DOM_DISTILLER_WEBUI_TITLE" desc="The title to show on the DOM Distiller debug page."> <message name="IDS_DOM_DISTILLER_WEBUI_TITLE" desc="The title to show on the DOM Distiller debug page.">
DOM Distiller DOM Distiller
</message> </message>
<message name="IDS_DOM_DISTILLER_VIEWER_TITLE_SUFFIX" desc="The suffix to show after the page title to indicate we are in reader mode. For example, if the page title was 'An Article', this would be appended to create the title 'An Article - Reader Mode'.">
Reader Mode
</message>
</grit-part> </grit-part>
f049a5162a611e94ae4e6912dd941393972ced8a
\ No newline at end of file
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