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

Unified Diff: chrome/browser/resources/file_manager/js/file_manager.js

Issue 10413011: redo r137692 and r137791 which were speculatively reverted (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/file_manager/js/file_manager.js
diff --git a/chrome/browser/resources/file_manager/js/file_manager.js b/chrome/browser/resources/file_manager/js/file_manager.js
index 89230a2d99950fe24e0a02b0461afe84f086e486..0f428269b42d068ca454bb8be6b803fe5894a81f 100644
--- a/chrome/browser/resources/file_manager/js/file_manager.js
+++ b/chrome/browser/resources/file_manager/js/file_manager.js
@@ -121,11 +121,6 @@ FileManager.prototype = {
var MINIMUM_BUTTER_DISPLAY_TIME_MS = 1300;
/**
- * Translated strings.
- */
- var localStrings;
-
- /**
* Item for the Grid View.
* @constructor
*/
@@ -156,27 +151,27 @@ FileManager.prototype = {
* Return a translated string.
*
* Wrapper function to make dealing with translated strings more concise.
- * Equivilant to localStrings.getString(id).
+ * Equivalent to loadTimeData.getString(id).
*
* @param {string} id The id of the string to return.
* @return {string} The translated string.
*/
function str(id) {
- return localStrings.getString(id) || ('UNLOCALIZED STRING ' + id);
+ return loadTimeData.getString(id);
}
/**
* Return a translated string with arguments replaced.
*
* Wrapper function to make dealing with translated strings more concise.
- * Equivilant to localStrings.getStringF(id, ...).
+ * Equivilant to loadTimeData.getStringF(id, ...).
*
* @param {string} id The id of the string to return.
* @param {...string} The values to replace into the string.
* @return {string} The translated string with replaced values.
*/
function strf(id, var_args) {
- return localStrings.getStringF.apply(localStrings, arguments);
+ return loadTimeData.getStringF.apply(loadTimeData, arguments);
}
/**
@@ -192,8 +187,8 @@ FileManager.prototype = {
break;
}
}
- return localStrings.getString('FILE_ERROR_' + code) ||
- localStrings.getStringF('FILE_ERROR_GENERIC', code);
+ return loadTimeData.getString('FILE_ERROR_' + code) ||
+ loadTimeData.getStringF('FILE_ERROR_GENERIC', code);
}
/**
@@ -274,7 +269,7 @@ FileManager.prototype = {
*/
FileManager.initStrings = function(callback) {
chrome.fileBrowserPrivate.getStrings(function(strings) {
- localStrings = new LocalStrings(strings);
+ loadTimeData.data = strings;
if (callback)
callback();
});
@@ -611,7 +606,7 @@ FileManager.prototype = {
this.dialogDom_.ownerDocument.defaultView.addEventListener(
'resize', this.onResize_.bind(this));
- if (str('ASH') == '1')
+ if (loadTimeData.getBoolean('ASH'))
this.dialogDom_.setAttribute('ash', 'true');
this.filePopup_ = null;
@@ -620,7 +615,7 @@ FileManager.prototype = {
'input', this.onSearchBoxUpdate_.bind(this));
// Populate the static localized strings.
- i18nTemplate.process(this.document_, localStrings.templateData);
+ i18nTemplate.process(this.document_, loadTimeData);
};
/**
@@ -2470,7 +2465,9 @@ FileManager.prototype = {
task.title = str('ACTION_OPEN');
} else if (task_parts[1] == 'view-pdf') {
// Do not render this task if disabled.
- if (str('PDF_VIEW_ENABLED') == 'false') continue;
+ if (!loadTimeData.getBoolean('PDF_VIEW_ENABLED'))
+ continue;
+
task.iconUrl =
chrome.extension.getURL('images/filetype_pdf.png');
task.title = str('ACTION_VIEW');
@@ -2644,7 +2641,7 @@ FileManager.prototype = {
FileManager.prototype.getGDataPreferences_ = function() {
return this.gdataPreferences_ ||
- { driveEnabled: str('ENABLE_GDATA') == '1' };
+ { driveEnabled: loadTimeData.getBoolean('ENABLE_GDATA') };
};
FileManager.prototype.getNetworkConnectionState_ = function() {

Powered by Google App Engine
This is Rietveld 408576698