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