OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // A helper function for using JsTemplate. See jstemplate_builder.h for more | 5 // A helper function for using JsTemplate. See jstemplate_builder.h for more |
6 // info. | 6 // info. |
7 | 7 |
8 #include "chrome/common/jstemplate_builder.h" | 8 #include "chrome/common/jstemplate_builder.h" |
9 | 9 |
10 #include "app/resource_bundle.h" | |
11 #include "base/logging.h" | 10 #include "base/logging.h" |
12 #include "base/string_util.h" | 11 #include "base/string_util.h" |
13 #include "chrome/common/json_value_serializer.h" | 12 #include "chrome/common/json_value_serializer.h" |
14 | |
15 #include "grit/common_resources.h" | 13 #include "grit/common_resources.h" |
| 14 #include "ui/base/resource/resource_bundle.h" |
16 | 15 |
17 namespace jstemplate_builder { | 16 namespace jstemplate_builder { |
18 | 17 |
19 std::string GetTemplateHtml(const base::StringPiece& html_template, | 18 std::string GetTemplateHtml(const base::StringPiece& html_template, |
20 const DictionaryValue* json, | 19 const DictionaryValue* json, |
21 const base::StringPiece& template_id) { | 20 const base::StringPiece& template_id) { |
22 std::string output(html_template.data(), html_template.size()); | 21 std::string output(html_template.data(), html_template.size()); |
23 AppendJsonHtml(json, &output); | 22 AppendJsonHtml(json, &output); |
24 AppendJsTemplateSourceHtml(&output); | 23 AppendJsTemplateSourceHtml(&output); |
25 AppendJsTemplateProcessHtml(template_id, &output); | 24 AppendJsTemplateProcessHtml(template_id, &output); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 output->append("</script>"); | 106 output->append("</script>"); |
108 } | 107 } |
109 | 108 |
110 void AppendI18nTemplateProcessHtml(std::string* output) { | 109 void AppendI18nTemplateProcessHtml(std::string* output) { |
111 output->append("<script>"); | 110 output->append("<script>"); |
112 output->append("i18nTemplate.process(document, templateData);"); | 111 output->append("i18nTemplate.process(document, templateData);"); |
113 output->append("</script>"); | 112 output->append("</script>"); |
114 } | 113 } |
115 | 114 |
116 } // namespace jstemplate_builder | 115 } // namespace jstemplate_builder |
OLD | NEW |