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

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: 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
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..9d9b4ee4b911f12a90b3e5d01bb63c7abcc18b85 100644
--- a/components/dom_distiller/core/viewer.cc
+++ b/components/dom_distiller/core/viewer.cc
@@ -113,8 +113,22 @@ 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
+#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.
cjhopman 2015/03/19 21:24:52 I was under the impression that on iOS we could ha
nyquist 2015/03/19 21:39:15 +1 many times. I think at least up to a +4 here.
+ substitutions.push_back(viewer::GetCss()); // $2
+ std::ostringstream script;
+ script << "<script>\n" << viewer::GetJavaScript() << "\n</script>";
+ substitutions.push_back(script.str()); // $3
+#else
+ std::ostringstream css;
+ css << "<link rel=\"stylesheet\" href=\"/" << kViewerCssPath << "\">";
+ substitutions.push_back(css.str()); // $2
+ std::ostringstream script;
+ script << "<script src=\"" << kViewerJsPath << "\"></script>";
+ substitutions.push_back(script.str()); // $3
+#endif // defined(OS_IOS)
+
substitutions.push_back(GetThemeCssClass(theme) + " " +
GetFontCssClass(font_family)); // $4
substitutions.push_back(content); // $5

Powered by Google App Engine
This is Rietveld 408576698