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

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

Issue 10391075: convert chromeos file manager to loadTimeData (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync 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 ac298227a658f7af38bf9a2b94b975b08d23896a..997986d1f7444c051bdb56eb074a509c4a5ef8a4 100644
--- a/chrome/browser/resources/file_manager/js/file_manager.js
+++ b/chrome/browser/resources/file_manager/js/file_manager.js
@@ -113,11 +113,6 @@ FileManager.prototype = {
var MINIMUM_BUTTER_DISPLAY_TIME_MS = 1300;
/**
- * Translated strings.
- */
- var localStrings;
-
- /**
* Item for the Grid View.
* @constructor
*/
@@ -148,27 +143,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);
}
/**
@@ -184,8 +179,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);
}
/**
@@ -259,7 +254,7 @@ FileManager.prototype = {
*/
FileManager.initStrings = function(callback) {
chrome.fileBrowserPrivate.getStrings(function(strings) {
- localStrings = new LocalStrings(strings);
+ loadTimeData.data = strings;
if (callback)
callback();
});
@@ -596,7 +591,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;
@@ -605,7 +600,7 @@ FileManager.prototype = {
'input', this.onSearchBoxUpdate_.bind(this));
// Populate the static localized strings.
- i18nTemplate.process(this.document_, localStrings.templateData);
+ i18nTemplate.process(this.document_, loadTimeData);
};
/**
@@ -2436,7 +2431,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');
@@ -2610,7 +2607,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