Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Unified Diff: components/dom_distiller/content/dom_distiller_viewer_source.cc

Issue 430473007: Font Family Preferences for Distilled Pages (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/dom_distiller/content/dom_distiller_viewer_source.cc
diff --git a/components/dom_distiller/content/dom_distiller_viewer_source.cc b/components/dom_distiller/content/dom_distiller_viewer_source.cc
index 964794e7e40da536a2869a2cb3cba6a95d7cdfb9..d8d891b56184653f452006be5e8ae9afa09f42c5 100644
--- a/components/dom_distiller/content/dom_distiller_viewer_source.cc
+++ b/components/dom_distiller/content/dom_distiller_viewer_source.cc
@@ -73,6 +73,8 @@ class DomDistillerViewerSource::RequestViewerHandle
void Cancel();
// DistilledPagePrefs::Observer implementation:
+ virtual void OnChangeFontFamily(
+ DistilledPagePrefs::FontFamily new_font_family) OVERRIDE;
virtual void OnChangeTheme(DistilledPagePrefs::Theme new_theme) OVERRIDE;
// The handle to the view request towards the DomDistillerService. It
@@ -187,8 +189,10 @@ void DomDistillerViewerSource::RequestViewerHandle::OnArticleReady(
const DistilledArticleProto* article_proto) {
if (page_count_ == 0) {
// This is a single-page article.
- std::string unsafe_page_html = viewer::GetUnsafeArticleHtml(
- article_proto, distilled_page_prefs_->GetTheme());
+ std::string unsafe_page_html =
+ viewer::GetUnsafeArticleHtml(article_proto,
robliao 2014/08/10 02:43:45 Consistency: Wrap these arguments to the next line
sunangel 2014/08/11 21:51:33 Can you explain what you mean? Git cl format turne
robliao 2014/08/11 22:00:45 Look at GetUnsafePartialArticleHtml below. Use tha
sunangel 2014/08/12 02:09:55 Done.
+ distilled_page_prefs_->GetTheme(),
+ distilled_page_prefs_->GetFontFamily());
callback_.Run(base::RefCountedString::TakeString(&unsafe_page_html));
} else if (page_count_ == article_proto->pages_size()) {
// We may still be showing the "Loading" indicator.
@@ -217,7 +221,9 @@ void DomDistillerViewerSource::RequestViewerHandle::OnArticleUpdated(
if (page_count_ == 0) {
// This is the first page, so send Viewer page scaffolding too.
std::string unsafe_page_html = viewer::GetUnsafePartialArticleHtml(
- &page, distilled_page_prefs_->GetTheme());
+ &page,
+ distilled_page_prefs_->GetTheme(),
+ distilled_page_prefs_->GetFontFamily());
callback_.Run(base::RefCountedString::TakeString(&unsafe_page_html));
} else {
SendJavaScript(
@@ -236,6 +242,11 @@ void DomDistillerViewerSource::RequestViewerHandle::OnChangeTheme(
SendJavaScript(viewer::GetDistilledPageThemeJs(new_theme));
}
+void DomDistillerViewerSource::RequestViewerHandle::OnChangeFontFamily(
+ DistilledPagePrefs::FontFamily new_font) {
+ SendJavaScript(viewer::GetDistilledPageFontFamilyJs(new_font));
+}
+
DomDistillerViewerSource::DomDistillerViewerSource(
DomDistillerServiceInterface* dom_distiller_service,
const std::string& scheme)
@@ -300,7 +311,8 @@ void DomDistillerViewerSource::StartDataRequest(
delete request_viewer_handle;
std::string error_page_html = viewer::GetErrorPageHtml(
- dom_distiller_service_->GetDistilledPagePrefs()->GetTheme());
+ dom_distiller_service_->GetDistilledPagePrefs()->GetTheme(),
+ dom_distiller_service_->GetDistilledPagePrefs()->GetFontFamily());
callback.Run(base::RefCountedString::TakeString(&error_page_html));
}
};

Powered by Google App Engine
This is Rietveld 408576698