summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryfriedman@chromium.org <yfriedman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-16 11:53:22 +0000
committeryfriedman@chromium.org <yfriedman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-16 11:53:22 +0000
commitc162b848dc8e814550d22326988d843fd13a8168 (patch)
tree91b12f6cc884f33600b20995a13f9c3436c797f9
parenteb4e12411d416bca95cfa116d47cc9c2a7cf07e7 (diff)
downloadchromium_src-c162b848dc8e814550d22326988d843fd13a8168.zip
chromium_src-c162b848dc8e814550d22326988d843fd13a8168.tar.gz
chromium_src-c162b848dc8e814550d22326988d843fd13a8168.tar.bz2
Some minor polish for the DomDistiller viewer
1) Add a viewport tag and increase font size to improve readability. 2) Add a link back to original source at the bottom of the page. BUG=319881 Review URL: https://codereview.chromium.org/199613002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@257370 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--components/dom_distiller/content/dom_distiller_viewer_source.cc25
-rw-r--r--components/dom_distiller/content/resources/dom_distiller_viewer.html4
-rw-r--r--components/dom_distiller_strings.grdp3
-rw-r--r--third_party/readability/css/readability.css2
4 files changed, 26 insertions, 8 deletions
diff --git a/components/dom_distiller/content/dom_distiller_viewer_source.cc b/components/dom_distiller/content/dom_distiller_viewer_source.cc
index 4538eb5..90f3e45 100644
--- a/components/dom_distiller/content/dom_distiller_viewer_source.cc
+++ b/components/dom_distiller/content/dom_distiller_viewer_source.cc
@@ -32,15 +32,20 @@ namespace dom_distiller {
namespace {
-std::string ReplaceHtmlTemplateValues(std::string title, std::string content) {
+std::string ReplaceHtmlTemplateValues(const std::string& title,
+ const std::string& content,
+ const std::string& original_url) {
base::StringPiece html_template =
ResourceBundle::GetSharedInstance().GetRawDataResource(
IDR_DOM_DISTILLER_VIEWER_HTML);
std::vector<std::string> substitutions;
- substitutions.push_back(title); // $1
- substitutions.push_back(kCssPath); // $2
- substitutions.push_back(title); // $3
- substitutions.push_back(content); // $4
+ substitutions.push_back(title); // $1
+ substitutions.push_back(kCssPath); // $2
+ substitutions.push_back(title); // $3
+ substitutions.push_back(content); // $4
+ substitutions.push_back(original_url); // $5
+ substitutions.push_back(
+ l10n_util::GetStringUTF8(IDS_DOM_DISTILLER_VIEWER_VIEW_ORIGINAL)); // $6
return ReplaceStringPlaceholders(html_template, substitutions, NULL);
}
@@ -99,8 +104,14 @@ void DomDistillerViewerSource::RequestViewerHandle::OnArticleReady(
unsafe_article_html =
l10n_util::GetStringUTF8(IDS_DOM_DISTILLER_VIEWER_NO_DATA_CONTENT);
}
+
+ std::string original_url;
+ if (article_proto->pages_size() > 0 && article_proto->pages(0).has_url()) {
+ original_url = article_proto->pages(0).url();
+ }
+
std::string unsafe_page_html =
- ReplaceHtmlTemplateValues(title, unsafe_article_html);
+ ReplaceHtmlTemplateValues(title, unsafe_article_html, original_url);
callback_.Run(base::RefCountedString::TakeString(&unsafe_page_html));
base::MessageLoop::current()->DeleteSoon(FROM_HERE, this);
}
@@ -167,7 +178,7 @@ void DomDistillerViewerSource::StartDataRequest(
IDS_DOM_DISTILLER_VIEWER_FAILED_TO_FIND_ARTICLE_TITLE);
std::string content = l10n_util::GetStringUTF8(
IDS_DOM_DISTILLER_VIEWER_FAILED_TO_FIND_ARTICLE_CONTENT);
- std::string html = ReplaceHtmlTemplateValues(title, content);
+ std::string html = ReplaceHtmlTemplateValues(title, content, "");
callback.Run(base::RefCountedString::TakeString(&html));
}
};
diff --git a/components/dom_distiller/content/resources/dom_distiller_viewer.html b/components/dom_distiller/content/resources/dom_distiller_viewer.html
index 0b05f95..03929c4 100644
--- a/components/dom_distiller/content/resources/dom_distiller_viewer.html
+++ b/components/dom_distiller/content/resources/dom_distiller_viewer.html
@@ -7,6 +7,7 @@ found in the LICENSE file.
<html>
<head>
<meta charset="utf-8">
+ <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
<title>$1</title>
<link rel="stylesheet" type="text/css" href="/$2">
</head>
@@ -21,5 +22,8 @@ found in the LICENSE file.
</article>
</div>
</div>
+ <div>
+ <a href="$5">$6</a>
+ </div>
</body>
</html>
diff --git a/components/dom_distiller_strings.grdp b/components/dom_distiller_strings.grdp
index ec722ad..4d99fd6 100644
--- a/components/dom_distiller_strings.grdp
+++ b/components/dom_distiller_strings.grdp
@@ -40,5 +40,8 @@
<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.
</message>
+ <message name="IDS_DOM_DISTILLER_VIEWER_VIEW_ORIGINAL" desc="The text to show on a link of an article to view the original page.">
+ View Original
+ </message>
</grit-part>
diff --git a/third_party/readability/css/readability.css b/third_party/readability/css/readability.css
index 72eae67..1f7cf67 100644
--- a/third_party/readability/css/readability.css
+++ b/third_party/readability/css/readability.css
@@ -1,6 +1,6 @@
@charset "utf-8";
/* Document */
-body{font-size:10px;line-height:1;}
+body{font-family:'Open Sans',sans-serif;font-size:18px;line-height:1.4;}
#readTools a{background-color:transparent!important;background-image:url(http://kerrick.github.com/readability-js/sprite-readability.png)!important;background-repeat:no-repeat!important;}
#readOverlay{text-rendering:optimizeLegibility;display:block;position:absolute;top:0;left:0;width:100%;}
#readInner{max-width:800px;margin:1em auto;}