Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(362)

Side by Side Diff: chrome/common/jstemplate_builder.h

Issue 193072: Move StringPiece into the base namespace. It is colliding (Closed)
Patch Set: take 2 Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/common/extensions/user_script.h ('k') | chrome/common/jstemplate_builder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 class DictionaryValue; 18 class DictionaryValue;
19 namespace base {
19 class StringPiece; 20 class StringPiece;
21 }
20 22
21 namespace jstemplate_builder { 23 namespace jstemplate_builder {
22 24
23 // A helper function that generates a string of HTML to be loaded. The 25 // 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 26 // string includes the HTML and the javascript code necessary to generate the
25 // full page with support for JsTemplates. 27 // full page with support for JsTemplates.
26 std::string GetTemplateHtml(const StringPiece& html_template, 28 std::string GetTemplateHtml(const base::StringPiece& html_template,
27 const DictionaryValue* json, 29 const DictionaryValue* json,
28 const StringPiece& template_id); 30 const base::StringPiece& template_id);
29 31
30 // A helper function that generates a string of HTML to be loaded. The 32 // A helper function that generates a string of HTML to be loaded. The
31 // string includes the HTML and the javascript code necessary to generate the 33 // string includes the HTML and the javascript code necessary to generate the
32 // full page with support for i18n Templates. 34 // full page with support for i18n Templates.
33 std::string GetI18nTemplateHtml(const StringPiece& html_template, 35 std::string GetI18nTemplateHtml(const base::StringPiece& html_template,
34 const DictionaryValue* json); 36 const DictionaryValue* json);
35 37
36 // A helper function that generates a string of HTML to be loaded. The 38 // A helper function that generates a string of HTML to be loaded. The
37 // string includes the HTML and the javascript code necessary to generate the 39 // string includes the HTML and the javascript code necessary to generate the
38 // full page with support for both i18n Templates and JsTemplates. 40 // full page with support for both i18n Templates and JsTemplates.
39 std::string GetTemplatesHtml(const StringPiece& html_template, 41 std::string GetTemplatesHtml(const base::StringPiece& html_template,
40 const DictionaryValue* json, 42 const DictionaryValue* json,
41 const StringPiece& template_id); 43 const base::StringPiece& template_id);
42 44
43 // The following functions build up the different parts that the above 45 // The following functions build up the different parts that the above
44 // templates use. 46 // templates use.
45 47
46 // Appends a script tag with a variable name |templateData| that has the JSON 48 // Appends a script tag with a variable name |templateData| that has the JSON
47 // assigned to it. 49 // assigned to it.
48 void AppendJsonHtml(const DictionaryValue* json, std::string* output); 50 void AppendJsonHtml(const DictionaryValue* json, std::string* output);
49 51
50 // Appends the source for JsTemplates in a script tag. 52 // Appends the source for JsTemplates in a script tag.
51 void AppendJsTemplateSourceHtml(std::string* output); 53 void AppendJsTemplateSourceHtml(std::string* output);
52 54
53 // Appends the code that processes the JsTemplate with the JSON. You should 55 // Appends the code that processes the JsTemplate with the JSON. You should
54 // call AppendJsTemplateSourceHtml and AppendJsonHtml before calling this. 56 // call AppendJsTemplateSourceHtml and AppendJsonHtml before calling this.
55 void AppendJsTemplateProcessHtml(const StringPiece& template_id, 57 void AppendJsTemplateProcessHtml(const base::StringPiece& template_id,
56 std::string* output); 58 std::string* output);
57 59
58 // Appends the source for i18n Templates in a script tag. 60 // Appends the source for i18n Templates in a script tag.
59 void AppendI18nTemplateSourceHtml(std::string* output); 61 void AppendI18nTemplateSourceHtml(std::string* output);
60 62
61 // Appends the code that processes the i18n Template with the JSON. You 63 // Appends the code that processes the i18n Template with the JSON. You
62 // should call AppendJsTemplateSourceHtml and AppendJsonHtml before calling 64 // should call AppendJsTemplateSourceHtml and AppendJsonHtml before calling
63 // this. 65 // this.
64 void AppendI18nTemplateProcessHtml(std::string* output); 66 void AppendI18nTemplateProcessHtml(std::string* output);
65 67
66 } // namespace jstemplate_builder 68 } // namespace jstemplate_builder
67 #endif // CHROME_COMMON_JSTEMPLATE_BUILDER_H_ 69 #endif // CHROME_COMMON_JSTEMPLATE_BUILDER_H_
OLDNEW
« no previous file with comments | « chrome/common/extensions/user_script.h ('k') | chrome/common/jstemplate_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698