OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 |
(...skipping 15 matching lines...) Expand all Loading... |
26 | 26 |
27 // While an object of this class is in scope, the template builder will output | 27 // While an object of this class is in scope, the template builder will output |
28 // version 2 html. Version 2 uses load_time_data.js and i18n_template2.js, and | 28 // version 2 html. Version 2 uses load_time_data.js and i18n_template2.js, and |
29 // should soon become the default. | 29 // should soon become the default. |
30 class UseVersion2 { | 30 class UseVersion2 { |
31 public: | 31 public: |
32 UseVersion2(); | 32 UseVersion2(); |
33 ~UseVersion2(); | 33 ~UseVersion2(); |
34 | 34 |
35 private: | 35 private: |
36 bool previous_value_; | |
37 | |
38 DISALLOW_COPY_AND_ASSIGN(UseVersion2); | 36 DISALLOW_COPY_AND_ASSIGN(UseVersion2); |
39 }; | 37 }; |
40 | 38 |
41 // A helper function that generates a string of HTML to be loaded. The | 39 // A helper function that generates a string of HTML to be loaded. The |
42 // string includes the HTML and the javascript code necessary to generate the | 40 // string includes the HTML and the javascript code necessary to generate the |
43 // full page with support for JsTemplates. | 41 // full page with support for JsTemplates. |
44 std::string GetTemplateHtml(const base::StringPiece& html_template, | 42 std::string GetTemplateHtml(const base::StringPiece& html_template, |
45 const base::DictionaryValue* json, | 43 const base::DictionaryValue* json, |
46 const base::StringPiece& template_id); | 44 const base::StringPiece& template_id); |
47 | 45 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 // Appends the source for i18n Templates in a script tag. | 78 // Appends the source for i18n Templates in a script tag. |
81 void AppendI18nTemplateSourceHtml(std::string* output); | 79 void AppendI18nTemplateSourceHtml(std::string* output); |
82 | 80 |
83 // Appends the code that processes the i18n Template with the JSON. You | 81 // Appends the code that processes the i18n Template with the JSON. You |
84 // should call AppendJsTemplateSourceHtml and AppendJsonHtml before calling | 82 // should call AppendJsTemplateSourceHtml and AppendJsonHtml before calling |
85 // this. | 83 // this. |
86 void AppendI18nTemplateProcessHtml(std::string* output); | 84 void AppendI18nTemplateProcessHtml(std::string* output); |
87 | 85 |
88 } // namespace jstemplate_builder | 86 } // namespace jstemplate_builder |
89 #endif // CHROME_COMMON_JSTEMPLATE_BUILDER_H_ | 87 #endif // CHROME_COMMON_JSTEMPLATE_BUILDER_H_ |
OLD | NEW |