Rename a bunch of DOMUI shared resources.
BUG=None
TEST=manual
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46027 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/resources/bookmark_manager/js/bmm/bookmarklist.js b/chrome/browser/resources/bookmark_manager/js/bmm/bookmark_list.js
similarity index 100%
rename from chrome/browser/resources/bookmark_manager/js/bmm/bookmarklist.js
rename to chrome/browser/resources/bookmark_manager/js/bmm/bookmark_list.js
diff --git a/chrome/browser/resources/bookmark_manager/js/bmm/bookmarktree.js b/chrome/browser/resources/bookmark_manager/js/bmm/bookmark_tree.js
similarity index 100%
rename from chrome/browser/resources/bookmark_manager/js/bmm/bookmarktree.js
rename to chrome/browser/resources/bookmark_manager/js/bmm/bookmark_tree.js
diff --git a/chrome/browser/resources/bookmark_manager/js/bmm/treeiterator.js b/chrome/browser/resources/bookmark_manager/js/bmm/tree_iterator.js
similarity index 100%
rename from chrome/browser/resources/bookmark_manager/js/bmm/treeiterator.js
rename to chrome/browser/resources/bookmark_manager/js/bmm/tree_iterator.js
diff --git a/chrome/browser/resources/bookmark_manager/js/bmm/treeiterator_test.html b/chrome/browser/resources/bookmark_manager/js/bmm/tree_iterator_test.html
similarity index 100%
rename from chrome/browser/resources/bookmark_manager/js/bmm/treeiterator_test.html
rename to chrome/browser/resources/bookmark_manager/js/bmm/tree_iterator_test.html
diff --git a/chrome/browser/resources/bookmark_manager/main.html b/chrome/browser/resources/bookmark_manager/main.html
index a476ccec..b025b949 100644
--- a/chrome/browser/resources/bookmark_manager/main.html
+++ b/chrome/browser/resources/bookmark_manager/main.html
@@ -20,29 +20,29 @@
<script src="chrome://resources/js/cr.js"></script>
<script src="chrome://resources/js/cr/event.js"></script>
-<script src="chrome://resources/js/cr/eventtarget.js"></script>
-<script src="chrome://resources/js/cr/linkcontroller.js"></script>
+<script src="chrome://resources/js/cr/event_target.js"></script>
+<script src="chrome://resources/js/cr/link_controller.js"></script>
<script src="chrome://resources/js/cr/promise.js"></script>
<script src="chrome://resources/js/cr/ui.js"></script>
-<script src="chrome://resources/js/cr/ui/listselectionmodel.js"></script>
-<script src="chrome://resources/js/cr/ui/listitem.js"></script>
+<script src="chrome://resources/js/cr/ui/list_selection_model.js"></script>
+<script src="chrome://resources/js/cr/ui/list_item.js"></script>
<script src="chrome://resources/js/cr/ui/list.js"></script>
<script src="chrome://resources/js/cr/ui/tree.js"></script>
<script src="chrome://resources/js/cr/ui/splitter.js"></script>
<script src="chrome://resources/js/cr/ui/command.js"></script>
-<script src="chrome://resources/js/cr/ui/menuitem.js"></script>
+<script src="chrome://resources/js/cr/ui/menu_item.js"></script>
<script src="chrome://resources/js/cr/ui/menu.js"></script>
-<script src="chrome://resources/js/cr/ui/menubutton.js"></script>
-<script src="chrome://resources/js/cr/ui/contextmenuhandler.js"></script>
+<script src="chrome://resources/js/cr/ui/menu_button.js"></script>
+<script src="chrome://resources/js/cr/ui/context_menu_handler.js"></script>
<script src="chrome://resources/js/util.js"></script>
-<script src="chrome://resources/js/localstrings.js"></script>
-<script src="chrome://resources/js/i18ntemplate.js"></script>
+<script src="chrome://resources/js/local_strings.js"></script>
+<script src="chrome://resources/js/i18n_template.js"></script>
-<script src="js/bmm/treeiterator.js"></script>
+<script src="js/bmm/tree_iterator.js"></script>
<script src="js/bmm.js"></script>
-<script src="js/bmm/bookmarklist.js"></script>
-<script src="js/bmm/bookmarktree.js"></script>
+<script src="js/bmm/bookmark_list.js"></script>
+<script src="js/bmm/bookmark_tree.js"></script>
<script>
diff --git a/chrome/browser/resources/shared/js/cr/eventtarget.js b/chrome/browser/resources/shared/js/cr/event_target.js
similarity index 100%
rename from chrome/browser/resources/shared/js/cr/eventtarget.js
rename to chrome/browser/resources/shared/js/cr/event_target.js
diff --git a/chrome/browser/resources/shared/js/cr/eventtarget_test.html b/chrome/browser/resources/shared/js/cr/event_target_test.html
similarity index 100%
rename from chrome/browser/resources/shared/js/cr/eventtarget_test.html
rename to chrome/browser/resources/shared/js/cr/event_target_test.html
diff --git a/chrome/browser/resources/shared/js/cr/linkcontroller.js b/chrome/browser/resources/shared/js/cr/link_controller.js
similarity index 100%
rename from chrome/browser/resources/shared/js/cr/linkcontroller.js
rename to chrome/browser/resources/shared/js/cr/link_controller.js
diff --git a/chrome/browser/resources/shared/js/cr/linkcontroller_test.html b/chrome/browser/resources/shared/js/cr/link_controller_test.html
similarity index 100%
rename from chrome/browser/resources/shared/js/cr/linkcontroller_test.html
rename to chrome/browser/resources/shared/js/cr/link_controller_test.html
diff --git a/chrome/browser/resources/shared/js/cr/ui/contextmenuhandler.js b/chrome/browser/resources/shared/js/cr/ui/context_menu_handler.js
similarity index 100%
rename from chrome/browser/resources/shared/js/cr/ui/contextmenuhandler.js
rename to chrome/browser/resources/shared/js/cr/ui/context_menu_handler.js
diff --git a/chrome/browser/resources/shared/js/cr/ui/listitem.js b/chrome/browser/resources/shared/js/cr/ui/list_item.js
similarity index 100%
rename from chrome/browser/resources/shared/js/cr/ui/listitem.js
rename to chrome/browser/resources/shared/js/cr/ui/list_item.js
diff --git a/chrome/browser/resources/shared/js/cr/ui/listselectionmodel.js b/chrome/browser/resources/shared/js/cr/ui/list_selection_model.js
similarity index 100%
rename from chrome/browser/resources/shared/js/cr/ui/listselectionmodel.js
rename to chrome/browser/resources/shared/js/cr/ui/list_selection_model.js
diff --git a/chrome/browser/resources/shared/js/cr/ui/menubutton.js b/chrome/browser/resources/shared/js/cr/ui/menu_button.js
similarity index 100%
rename from chrome/browser/resources/shared/js/cr/ui/menubutton.js
rename to chrome/browser/resources/shared/js/cr/ui/menu_button.js
diff --git a/chrome/browser/resources/shared/js/cr/ui/menuitem.js b/chrome/browser/resources/shared/js/cr/ui/menu_item.js
similarity index 100%
rename from chrome/browser/resources/shared/js/cr/ui/menuitem.js
rename to chrome/browser/resources/shared/js/cr/ui/menu_item.js
diff --git a/chrome/browser/resources/shared/js/i18ntemplate.js b/chrome/browser/resources/shared/js/i18ntemplate.js
deleted file mode 100644
index 8166ddc7..0000000
--- a/chrome/browser/resources/shared/js/i18ntemplate.js
+++ /dev/null
@@ -1,104 +0,0 @@
-/**
- * @fileoverview This is a simple template engine inspired by JsTemplates
- * optimized for i18n.
- *
- * It currently supports two handlers:
- *
- * * i18n-content which sets the textContent of the element
- *
- * <span i18n-content="myContent"></span>
- * i18nTemplate.process(element, {'myContent': 'Content'});
- *
- * * i18n-values is a list of attribute-value or property-value pairs.
- * Properties are prefixed with a '.' and can contain nested properties.
- *
- * <span i18n-values="title:myTitle;.style.fontSize:fontSize"></span>
- * i18nTemplate.process(element, {
- * 'myTitle': 'Title',
- * 'fontSize': '13px'
- * });
- */
-
-var i18nTemplate = (function() {
- /**
- * This provides the handlers for the templating engine. The key is used as
- * the attribute name and the value is the function that gets called for every
- * single node that has this attribute.
- * @type {Object}
- */
- var handlers = {
- /**
- * This handler sets the textContent of the element.
- */
- 'i18n-content': function(element, attributeValue, obj) {
- element.textContent = obj[attributeValue];
- },
-
- /**
- * This is used to set HTML attributes and DOM properties,. The syntax is:
- * attributename:key;
- * .domProperty:key;
- * .nested.dom.property:key
- */
- 'i18n-values': function(element, attributeValue, obj) {
- var parts = attributeValue.replace(/\s/g, '').split(/;/);
- for (var j = 0; j < parts.length; j++) {
- var a = parts[j].match(/^([^:]+):(.+)$/);
- if (a) {
- var propName = a[1];
- var propExpr = a[2];
-
- // Ignore missing properties
- if (propExpr in obj) {
- var value = obj[propExpr];
- if (propName.charAt(0) == '.') {
- var path = propName.slice(1).split('.');
- var object = element;
- while (object && path.length > 1) {
- object = object[path.shift()];
- }
- if (object) {
- object[path] = value;
- // In case we set innerHTML (ignoring others) we need to
- // recursively check the content
- if (path == 'innerHTML') {
- process(element, obj);
- }
- }
- } else {
- element.setAttribute(propName, value);
- }
- } else {
- console.warn('i18n-values: Missing value for "' + propExpr + '"');
- }
- }
- }
- }
- };
-
- var attributeNames = [];
- for (var key in handlers) {
- attributeNames.push(key);
- }
- var selector = '[' + attributeNames.join('],[') + ']';
-
- /**
- * Processes a DOM tree with the {@code obj} map.
- */
- function process(node, obj) {
- var elements = node.querySelectorAll(selector);
- for (var element, i = 0; element = elements[i]; i++) {
- for (var j = 0; j < attributeNames.length; j++) {
- var name = attributeNames[j];
- var att = element.getAttribute(name);
- if (att != null) {
- handlers[name](element, att, obj);
- }
- }
- }
- }
-
- return {
- process: process
- };
-})();
diff --git a/chrome/browser/resources/shared/js/local_strings.js b/chrome/browser/resources/shared/js/local_strings.js
index 75b9859..ace7035 100644
--- a/chrome/browser/resources/shared/js/local_strings.js
+++ b/chrome/browser/resources/shared/js/local_strings.js
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// TODO(arv): Namespace
+
/**
* The local strings get injected into the page usig a variable named
* {@code templateData}. This class provides a simpler interface to access those
diff --git a/chrome/browser/resources/shared/js/localstrings.js b/chrome/browser/resources/shared/js/localstrings.js
deleted file mode 100644
index 86f888b5..0000000
--- a/chrome/browser/resources/shared/js/localstrings.js
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright (c) 2009-2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// TODO(arv): Namespace and share code with DOMUI
-
-/**
- * The local strings get injected into the page usig a varaible named
- * {@code templateData}. This class provides a simpler interface to access those
- * strings.
- * @constructor
- */
-function LocalStrings() {
-}
-
-LocalStrings.prototype = {
-
- /**
- * The template data object.
- * @type {Object}
- */
- templateData: null,
-
- /**
- * Gets a localized string by its id.
- * @param {string} s The id of the string we want.
- * @return {string} The localized string.
- */
- getString: function(id) {
- return this.templateData[id] || '';
- },
-
- /**
- * Returns a formatted localized string where all %s contents are replaced
- * by the second argument and where $1 to $9 are replaced by the second to
- * tenths arguments.
- * @param {string} id The ID of the string we want.
- * @param {string} v The string to include in the formatted string.
- * @param {...string} The extra values to include in the fomatted output.
- * @return {string} The formatted string.
- */
- getStringF: function(id, v, var_args) {
- // The localized messages should contain $n but they also use %s from time
- // to time so we support both until all the messages have been unified.
- var s = this.getString(id);
- var args = arguments;
- return s.replace(/%s|\$[$1-9]/g, function(m) {
- if (m == '%s')
- return v;
- if (m == '$$')
- return '$';
- return args[m[1]];
- });
- }
-};
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 0c2bf3c6..1a7486a6 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -3242,10 +3242,11 @@
{
'destination': '<(PRODUCT_DIR)/resources/shared/js',
'files': [
- 'browser/resources/shared/js/cr_test.html',
+ 'browser/resources/shared/js/class_list.js',
'browser/resources/shared/js/cr.js',
- 'browser/resources/shared/js/i18ntemplate.js',
- 'browser/resources/shared/js/localstrings.js',
+ 'browser/resources/shared/js/i18n_template.js',
+ 'browser/resources/shared/js/local_strings.js',
+ 'browser/resources/shared/js/parse_html_subset.js',
'browser/resources/shared/js/util.js',
]
},
@@ -3253,11 +3254,8 @@
'destination': '<(PRODUCT_DIR)/resources/shared/js/cr',
'files': [
'browser/resources/shared/js/cr/event.js',
- 'browser/resources/shared/js/cr/eventtarget_test.html',
- 'browser/resources/shared/js/cr/eventtarget.js',
- 'browser/resources/shared/js/cr/linkcontroller_test.html',
- 'browser/resources/shared/js/cr/linkcontroller.js',
- 'browser/resources/shared/js/cr/promise_test.html',
+ 'browser/resources/shared/js/cr/event_target.js',
+ 'browser/resources/shared/js/cr/link_controller.js',
'browser/resources/shared/js/cr/promise.js',
'browser/resources/shared/js/cr/ui.js',
]
@@ -3266,13 +3264,13 @@
'destination': '<(PRODUCT_DIR)/resources/shared/js/cr/ui',
'files': [
'browser/resources/shared/js/cr/ui/command.js',
- 'browser/resources/shared/js/cr/ui/contextmenuhandler.js',
+ 'browser/resources/shared/js/cr/ui/context_menu_handler.js',
'browser/resources/shared/js/cr/ui/list.js',
- 'browser/resources/shared/js/cr/ui/listitem.js',
- 'browser/resources/shared/js/cr/ui/listselectionmodel.js',
+ 'browser/resources/shared/js/cr/ui/list_item.js',
+ 'browser/resources/shared/js/cr/ui/list_selection_model.js',
'browser/resources/shared/js/cr/ui/menu.js',
- 'browser/resources/shared/js/cr/ui/menubutton.js',
- 'browser/resources/shared/js/cr/ui/menuitem.js',
+ 'browser/resources/shared/js/cr/ui/menu_button.js',
+ 'browser/resources/shared/js/cr/ui/menu_item.js',
'browser/resources/shared/js/cr/ui/splitter.js',
'browser/resources/shared/js/cr/ui/tree.js',
]
@@ -3310,9 +3308,9 @@
{
'destination': '<(PRODUCT_DIR)/resources/bookmark_manager/js/bmm',
'files': [
- 'browser/resources/bookmark_manager/js/bmm/bookmarklist.js',
- 'browser/resources/bookmark_manager/js/bmm/bookmarktree.js',
- 'browser/resources/bookmark_manager/js/bmm/treeiterator.js',
+ 'browser/resources/bookmark_manager/js/bmm/bookmark_list.js',
+ 'browser/resources/bookmark_manager/js/bmm/bookmark_tree.js',
+ 'browser/resources/bookmark_manager/js/bmm/tree_iterator.js',
]
},
{