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

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: synced 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 39f76bd17f260378cc06b8764c615a6374001882..3d26eb889426306f885df9b1b1dd52c839bf7873 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,11 @@ 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,
+ 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 +222,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 +243,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 +312,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