| 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 // This provides some helper methods for building and rendering an | 5 // This provides some helper methods for building and rendering an |
| 6 // internal html page. The flow is as follows: | 6 // internal html page. The flow is as follows: |
| 7 // - instantiate a builder given a webframe that we're going to render content | 7 // - instantiate a builder given a webframe that we're going to render content |
| 8 // into | 8 // into |
| 9 // - load the template html and load the jstemplate javascript into the frame | 9 // - load the template html and load the jstemplate javascript into the frame |
| 10 // - given a json data object, run the jstemplate javascript which fills in | 10 // - given a json data object, run the jstemplate javascript which fills in |
| 11 // template values | 11 // template values |
| 12 | 12 |
| 13 #ifndef CHROME_COMMON_JSTEMPLATE_BUILDER_H_ | 13 #ifndef CHROME_COMMON_JSTEMPLATE_BUILDER_H_ |
| 14 #define CHROME_COMMON_JSTEMPLATE_BUILDER_H_ | 14 #define CHROME_COMMON_JSTEMPLATE_BUILDER_H_ |
| 15 #pragma once | 15 #pragma once |
| 16 | 16 |
| 17 #include <string> | 17 #include <string> |
| 18 | 18 |
| 19 namespace base { |
| 19 class DictionaryValue; | 20 class DictionaryValue; |
| 20 namespace base { | |
| 21 class StringPiece; | 21 class StringPiece; |
| 22 } | 22 } |
| 23 | 23 |
| 24 using base::DictionaryValue; |
| 25 |
| 24 namespace jstemplate_builder { | 26 namespace jstemplate_builder { |
| 25 | 27 |
| 26 // A helper function that generates a string of HTML to be loaded. The | 28 // A helper function that generates a string of HTML to be loaded. The |
| 27 // string includes the HTML and the javascript code necessary to generate the | 29 // string includes the HTML and the javascript code necessary to generate the |
| 28 // full page with support for JsTemplates. | 30 // full page with support for JsTemplates. |
| 29 std::string GetTemplateHtml(const base::StringPiece& html_template, | 31 std::string GetTemplateHtml(const base::StringPiece& html_template, |
| 30 const DictionaryValue* json, | 32 const DictionaryValue* json, |
| 31 const base::StringPiece& template_id); | 33 const base::StringPiece& template_id); |
| 32 | 34 |
| 33 // A helper function that generates a string of HTML to be loaded. The | 35 // A helper function that generates a string of HTML to be loaded. The |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 // Appends the source for i18n Templates in a script tag. | 67 // Appends the source for i18n Templates in a script tag. |
| 66 void AppendI18nTemplateSourceHtml(std::string* output); | 68 void AppendI18nTemplateSourceHtml(std::string* output); |
| 67 | 69 |
| 68 // Appends the code that processes the i18n Template with the JSON. You | 70 // Appends the code that processes the i18n Template with the JSON. You |
| 69 // should call AppendJsTemplateSourceHtml and AppendJsonHtml before calling | 71 // should call AppendJsTemplateSourceHtml and AppendJsonHtml before calling |
| 70 // this. | 72 // this. |
| 71 void AppendI18nTemplateProcessHtml(std::string* output); | 73 void AppendI18nTemplateProcessHtml(std::string* output); |
| 72 | 74 |
| 73 } // namespace jstemplate_builder | 75 } // namespace jstemplate_builder |
| 74 #endif // CHROME_COMMON_JSTEMPLATE_BUILDER_H_ | 76 #endif // CHROME_COMMON_JSTEMPLATE_BUILDER_H_ |
| OLD | NEW |