diff options
author | arv@google.com <arv@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-14 00:40:25 +0000 |
---|---|---|
committer | arv@google.com <arv@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-14 00:40:25 +0000 |
commit | 7cd22a5102842cfbb51e06c626d769d81bb78210 (patch) | |
tree | 3a4ba627dc1589201cdb659d2aaa0d99c78111ed /chrome/browser/dom_ui | |
parent | 76f565227a89e88b6a0a32bf36cc5c01f6e418ca (diff) | |
download | chromium_src-7cd22a5102842cfbb51e06c626d769d81bb78210.zip chromium_src-7cd22a5102842cfbb51e06c626d769d81bb78210.tar.gz chromium_src-7cd22a5102842cfbb51e06c626d769d81bb78210.tar.bz2 |
This provides a simpler js template engine than JsTemplate. It has been
optimized for the way we do internationalization with JST before
and is about 4 times faster (average 4.8ms vs 22.8ms) for the history
page.
The syntax for this is very similar to JsTemplates. It uses the
attributes i18n-values and i18n-content which worls like jsvalues and
jscontent except that it does not allow arbitrary expressions.
BUG=None
TEST=All UI pages should work as before
Review URL: http://codereview.chromium.org/149420
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20590 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/dom_ui')
-rw-r--r-- | chrome/browser/dom_ui/downloads_ui.cc | 4 | ||||
-rw-r--r-- | chrome/browser/dom_ui/history_ui.cc | 5 | ||||
-rw-r--r-- | chrome/browser/dom_ui/new_tab_ui.cc | 11 |
3 files changed, 11 insertions, 9 deletions
diff --git a/chrome/browser/dom_ui/downloads_ui.cc b/chrome/browser/dom_ui/downloads_ui.cc index 60b5a369..aac3a86 100644 --- a/chrome/browser/dom_ui/downloads_ui.cc +++ b/chrome/browser/dom_ui/downloads_ui.cc @@ -99,8 +99,8 @@ void DownloadsUIHTMLSource::StartDataRequest(const std::string& path, static const StringPiece downloads_html( ResourceBundle::GetSharedInstance().GetRawDataResource( IDR_DOWNLOADS_HTML)); - const std::string full_html = jstemplate_builder::GetTemplateHtml( - downloads_html, &localized_strings, "t"); + const std::string full_html = jstemplate_builder::GetI18nTemplateHtml( + downloads_html, &localized_strings); scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes); html_bytes->data.resize(full_html.size()); diff --git a/chrome/browser/dom_ui/history_ui.cc b/chrome/browser/dom_ui/history_ui.cc index 1e0bd75..62e2e5d 100644 --- a/chrome/browser/dom_ui/history_ui.cc +++ b/chrome/browser/dom_ui/history_ui.cc @@ -81,8 +81,8 @@ void HistoryUIHTMLSource::StartDataRequest(const std::string& path, static const StringPiece history_html( ResourceBundle::GetSharedInstance().GetRawDataResource( IDR_HISTORY_HTML)); - const std::string full_html = jstemplate_builder::GetTemplateHtml( - history_html, &localized_strings, "t"); + const std::string full_html = jstemplate_builder::GetI18nTemplateHtml( + history_html, &localized_strings); scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes); html_bytes->data.resize(full_html.size()); @@ -99,7 +99,6 @@ void HistoryUIHTMLSource::StartDataRequest(const std::string& path, BrowsingHistoryHandler::BrowsingHistoryHandler() : search_text_(), remover_(NULL) { - } BrowsingHistoryHandler::~BrowsingHistoryHandler() { diff --git a/chrome/browser/dom_ui/new_tab_ui.cc b/chrome/browser/dom_ui/new_tab_ui.cc index 8525e08..3a53b24 100644 --- a/chrome/browser/dom_ui/new_tab_ui.cc +++ b/chrome/browser/dom_ui/new_tab_ui.cc @@ -371,8 +371,11 @@ void NewTabHTMLSource::StartDataRequest(const std::string& path, IDR_NEW_NEW_TAB_HTML); } - const std::string full_html = jstemplate_builder::GetTemplateHtml( - new_tab_html, &localized_strings, "t" /* template root node id */); + std::string full_html(new_tab_html.data(), new_tab_html.size()); + jstemplate_builder::AppendJsonHtml(&localized_strings, &full_html); + jstemplate_builder::AppendI18nTemplateSourceHtml(&full_html); + jstemplate_builder::AppendI18nTemplateProcessHtml(&full_html); + jstemplate_builder::AppendJsTemplateSourceHtml(&full_html); scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes); html_bytes->data.resize(full_html.size()); @@ -442,8 +445,8 @@ void IncognitoTabHTMLSource::StartDataRequest(const std::string& path, ResourceBundle::GetSharedInstance().GetRawDataResource( IDR_INCOGNITO_TAB_HTML)); - const std::string full_html = jstemplate_builder::GetTemplateHtml( - incognito_tab_html, &localized_strings, "t" /* template root node id */); + const std::string full_html = jstemplate_builder::GetI18nTemplateHtml( + incognito_tab_html, &localized_strings); scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes); html_bytes->data.resize(full_html.size()); |