OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/dom_distiller/core/viewer.h" | 5 #include "components/dom_distiller/core/viewer.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 // and return the local data once a page is loaded. | 119 // and return the local data once a page is loaded. |
120 css << "<style>" << viewer::GetCss() << "</style>"; | 120 css << "<style>" << viewer::GetCss() << "</style>"; |
121 script << "<script>\n" << viewer::GetJavaScript() << "\n</script>"; | 121 script << "<script>\n" << viewer::GetJavaScript() << "\n</script>"; |
122 #else | 122 #else |
123 css << "<link rel=\"stylesheet\" href=\"/" << kViewerCssPath << "\">"; | 123 css << "<link rel=\"stylesheet\" href=\"/" << kViewerCssPath << "\">"; |
124 script << "<script src=\"" << kViewerJsPath << "\"></script>"; | 124 script << "<script src=\"" << kViewerJsPath << "\"></script>"; |
125 #endif // defined(OS_IOS) | 125 #endif // defined(OS_IOS) |
126 | 126 |
127 substitutions.push_back( | 127 substitutions.push_back( |
128 l10n_util::GetStringUTF8(IDS_DOM_DISTILLER_VIEWER_LOADING_TITLE)); // $1 | 128 l10n_util::GetStringUTF8(IDS_DOM_DISTILLER_VIEWER_LOADING_TITLE)); // $1 |
| 129 |
129 substitutions.push_back(css.str()); // $2 | 130 substitutions.push_back(css.str()); // $2 |
130 | |
131 substitutions.push_back(GetThemeCssClass(theme) + " " + | 131 substitutions.push_back(GetThemeCssClass(theme) + " " + |
132 GetFontCssClass(font_family)); // $3 | 132 GetFontCssClass(font_family)); // $3 |
133 | 133 |
134 substitutions.push_back(original_url); // $4 | |
135 substitutions.push_back( | 134 substitutions.push_back( |
136 l10n_util::GetStringUTF8(IDS_DOM_DISTILLER_VIEWER_VIEW_ORIGINAL)); // $5 | 135 l10n_util::GetStringUTF8(IDS_DOM_DISTILLER_VIEWER_NO_DATA_TITLE)); // $4 |
| 136 substitutions.push_back( |
| 137 l10n_util::GetStringUTF8( |
| 138 IDS_DOM_DISTILLER_JAVASCRIPT_DISABLED_CONTENT)); // $5 |
137 | 139 |
138 substitutions.push_back(script.str()); // $6 | 140 substitutions.push_back(original_url); // $6 |
| 141 substitutions.push_back( |
| 142 l10n_util::GetStringUTF8(IDS_DOM_DISTILLER_VIEWER_VIEW_ORIGINAL)); // $7 |
| 143 |
| 144 substitutions.push_back(script.str()); // $8 |
139 | 145 |
140 return ReplaceStringPlaceholders(html_template, substitutions, NULL); | 146 return ReplaceStringPlaceholders(html_template, substitutions, NULL); |
141 } | 147 } |
142 | 148 |
143 } // namespace | 149 } // namespace |
144 | 150 |
145 namespace viewer { | 151 namespace viewer { |
146 | 152 |
147 const std::string GetShowFeedbackFormJs() { | 153 const std::string GetShowFeedbackFormJs() { |
148 base::StringValue question_val( | 154 base::StringValue question_val( |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 } | 293 } |
288 | 294 |
289 const std::string GetDistilledPageFontFamilyJs( | 295 const std::string GetDistilledPageFontFamilyJs( |
290 DistilledPagePrefs::FontFamily font_family) { | 296 DistilledPagePrefs::FontFamily font_family) { |
291 return "useFontFamily('" + GetJsFontFamily(font_family) + "');"; | 297 return "useFontFamily('" + GetJsFontFamily(font_family) + "');"; |
292 } | 298 } |
293 | 299 |
294 } // namespace viewer | 300 } // namespace viewer |
295 | 301 |
296 } // namespace dom_distiller | 302 } // namespace dom_distiller |
OLD | NEW |