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

Unified Diff: components/dom_distiller/core/viewer.cc

Issue 1008993007: Fix style on iOS for distilled content. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Real fix. Created 5 years, 9 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
« no previous file with comments | « components/dom_distiller/core/html/dom_distiller_viewer.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/dom_distiller/core/viewer.cc
diff --git a/components/dom_distiller/core/viewer.cc b/components/dom_distiller/core/viewer.cc
index 00e05ca447e2a8665bdffd1376ef9a5a590d91c5..6ae11a91ca0e9be0eb048e7c87126a9e47a7c607 100644
--- a/components/dom_distiller/core/viewer.cc
+++ b/components/dom_distiller/core/viewer.cc
@@ -113,8 +113,21 @@ std::string ReplaceHtmlTemplateValues(
IDR_DOM_DISTILLER_VIEWER_HTML);
std::vector<std::string> substitutions;
substitutions.push_back(title); // $1
- substitutions.push_back(kViewerCssPath); // $2
- substitutions.push_back(kViewerJsPath); // $3
+
+ std::ostringstream css;
+ std::ostringstream script;
+#if defined(OS_IOS)
+ // On iOS the content is inlined as there is no API to detect those requests
+ // and return the local data once a page is loaded.
+ css << "<style>" << viewer::GetCss() << "</style>";
+ script << "<script>\n" << viewer::GetJavaScript() << "\n</script>";
+#else
+ css << "<link rel=\"stylesheet\" href=\"/" << kViewerCssPath << "\">";
+ script << "<script src=\"" << kViewerJsPath << "\"></script>";
+#endif // defined(OS_IOS)
+ substitutions.push_back(css.str()); // $2
+ substitutions.push_back(script.str()); // $3
+
substitutions.push_back(GetThemeCssClass(theme) + " " +
GetFontCssClass(font_family)); // $4
substitutions.push_back(content); // $5
« no previous file with comments | « components/dom_distiller/core/html/dom_distiller_viewer.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698