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 | 15 |
16 #include <string> | 16 #include <string> |
17 | 17 |
18 #include "base/values.h" | 18 class DictionaryValue; |
19 | |
20 class StringPiece; | 19 class StringPiece; |
21 | 20 |
22 namespace jstemplate_builder { | 21 namespace jstemplate_builder { |
23 // A helper function that generates a string of HTML to be loaded. The | 22 // A helper function that generates a string of HTML to be loaded. The |
24 // string includes the HTML and the javascript code necessary to generate the | 23 // string includes the HTML and the javascript code necessary to generate the |
25 // full page. | 24 // full page. |
26 std::string GetTemplateHtml(const StringPiece& html_template, | 25 std::string GetTemplateHtml(const StringPiece& html_template, |
27 const DictionaryValue* json, | 26 const DictionaryValue* json, |
28 const StringPiece& template_id); | 27 const StringPiece& template_id); |
29 } // namespace jstemplate_builder | 28 } // namespace jstemplate_builder |
30 #endif // CHROME_COMMON_JSTEMPLATE_BUILDER_H_ | 29 #endif // CHROME_COMMON_JSTEMPLATE_BUILDER_H_ |
OLD | NEW |