Commit 3f12264f authored by yoshiki@chromium.org's avatar yoshiki@chromium.org

[Cleanup] Files.app: Remove 'this' from class methods. #1

In class method (not instance methods), we shouldn't use this because 'this' indicates not "instance" but "class" itself.

BUG=175657
TEST=Files.app launches. 
TBR=mtomasz@chromium.org, haruki@chromium.org

Review URL: https://chromiumcodereview.appspot.com/12257002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@182222 0039d316-1c4b-4281-b951-d872f2087c98
parent 185c51c6
......@@ -94,8 +94,6 @@ FileGrid.decorateThumbnail = function(li, entry, metadataCache) {
*/
FileGrid.decorateThumbnailBox = function(
box, entry, metadataCache, fillMode, opt_imageLoadCallback) {
var self = this;
box.className = 'img-container';
if (entry.isDirectory) {
box.setAttribute('generic-thumbnail', 'folder');
......
......@@ -28,7 +28,7 @@ var pyautoAPI = {
break;
}
}
this.sendValue_(entryExists);
pyautoAPI.sendValue_(entryExists);
},
/**
......@@ -41,7 +41,7 @@ var pyautoAPI = {
for (var i = 0; i < dm.length; i++) {
list.push(dm.item(i).name);
}
this.sendJSONValue_(list);
pyautoAPI.sendJSONValue_(list);
},
/**
......@@ -56,7 +56,7 @@ var pyautoAPI = {
} else {
throw new Error('Cannot save an item in this dialog type.');
}
this.sendDone_();
pyautoAPI.sendDone_();
},
/**
......@@ -72,7 +72,7 @@ var pyautoAPI = {
default:
throw new Error('Cannot open an item in this dialog type.');
}
this.sendDone_();
pyautoAPI.sendDone_();
},
/**
......@@ -89,7 +89,7 @@ var pyautoAPI = {
default:
throw new Error('Cannot execute a task in this dialog type.');
}
this.sendDone_();
pyautoAPI.sendDone_();
},
/**
......@@ -107,16 +107,16 @@ var pyautoAPI = {
* Copy selected items to clipboard.
*/
copyItems: function() {
this.executeClipboardCommand_('copy');
this.sendDone_();
pyautoAPI.executeClipboardCommand_('copy');
pyautoAPI.sendDone_();
},
/**
* Cut selected items to clipboard.
*/
cutItems: function() {
this.executeClipboardCommand_('cut');
this.sendDone_();
pyautoAPI.executeClipboardCommand_('cut');
pyautoAPI.sendDone_();
},
/**
......@@ -126,11 +126,11 @@ var pyautoAPI = {
var dm = fileManager.directoryModel_;
var onRescan = function() {
dm.removeEventListener('rescan-completed', onRescan);
this.sendDone_();
}.bind(this);
pyautoAPI.sendDone_();
};
dm.addEventListener('rescan-completed', onRescan);
this.executeClipboardCommand_('paste');
pyautoAPI.executeClipboardCommand_('paste');
},
/**
......@@ -139,8 +139,8 @@ var pyautoAPI = {
*/
renameItem: function(name) {
var entry = fileManager.getSelection().entries[0];
fileManager.directoryModel_.renameEntry(entry, name, this.sendDone_,
this.sendDone_);
fileManager.directoryModel_.renameEntry(entry, name, pyautoAPI.sendDone_,
pyautoAPI.sendDone_);
},
/**
......@@ -150,8 +150,8 @@ var pyautoAPI = {
var dm = fileManager.directoryModel_;
var onRescan = function() {
dm.removeEventListener('rescan-completed', onRescan);
this.sendDone_();
}.bind(this);
pyautoAPI.sendDone_();
};
dm.addEventListener('rescan-completed', onRescan);
fileManager.deleteSelection();
......@@ -165,8 +165,8 @@ var pyautoAPI = {
var dm = fileManager.directoryModel_;
var onRescan = function() {
dm.removeEventListener('rescan-completed', onRescan);
this.sendDone_();
}.bind(this);
pyautoAPI.sendDone_();
};
dm.addEventListener('rescan-completed', onRescan);
fileManager.directoryModel_.createDirectory(name, function() {});
......@@ -185,8 +185,8 @@ var pyautoAPI = {
var onChanged = function() {
dm.removeEventListener('directory-changed', onChanged);
this.sendDone_();
}.bind(this);
pyautoAPI.sendDone_();
};
dm.addEventListener('directory-changed', onChanged);
dm.changeDirectory(path);
......@@ -196,7 +196,7 @@ var pyautoAPI = {
* Get the absolute path of current directory.
*/
currentDirectory: function() {
this.sendValue_(fileManager.getCurrentDirectory());
pyautoAPI.sendValue_(fileManager.getCurrentDirectory());
},
/**
......@@ -205,8 +205,8 @@ var pyautoAPI = {
getSelectedDirectorySizeStats: function() {
var directoryURL = fileManager.getSelection().entries[0].toURL();
chrome.fileBrowserPrivate.getSizeStats(directoryURL, function(stats) {
this.sendJSONValue_(stats);
}.bind(this));
pyautoAPI.sendJSONValue_(stats);
});
},
/**
......@@ -218,7 +218,7 @@ var pyautoAPI = {
var initialized = fileManager &&
fileManager.workerInitialized_ &&
fileManager.getCurrentDirectory();
this.sendValue_(!!initialized);
pyautoAPI.sendValue_(!!initialized);
},
/**
......
......@@ -103,44 +103,44 @@ var harness = {
initPathControls: function() {
var paramstr = decodeURIComponent(document.location.search.substr(1));
this.params = paramstr ? JSON.parse(paramstr) : {};
harness.params = paramstr ? JSON.parse(paramstr) : {};
var input = document.querySelector('#default-path');
input.value = this.params.defaultPath || '';
input.addEventListener('keyup', this.onInputKeyUp.bind(this));
input.value = harness.params.defaultPath || '';
input.addEventListener('keyup', harness.onInputKeyUp);
},
initListeners: function() {
document.querySelector('input[type="file"]').
addEventListener('change', this.onFilesChange.bind(this));
addEventListener('change', harness.onFilesChange);
document.querySelector('button#reset').
addEventListener('click', this.onClearClick.bind(this));
addEventListener('click', harness.onClearClick);
document.querySelector('button#populate').
addEventListener('click', this.onPopulateClick.bind(this));
addEventListener('click', harness.onPopulateClick);
},
onInputKeyUp: function(event) {
if (event.keyCode != 13)
return;
this.changePath();
harness.changePath();
},
changePath: function() {
var input = document.querySelector('#default-path');
this.changeParam('defaultPath', input.value);
harness.changeParam('defaultPath', input.value);
},
changeParam: function(name, value) {
this.params[name] = value;
document.location.href = '?' + JSON.stringify(this.params);
harness.params[name] = value;
document.location.href = '?' + JSON.stringify(harness.params);
},
/**
* 'Reset Filesystem' button click handler.
*/
onClearClick: function() {
harness.resetFilesystem(this.filesystem, harness.initFileSystem);
harness.resetFilesystem(harness.filesystem, harness.initFileSystem);
},
resetFilesystem: function(filesystem, opt_callback) {
......@@ -161,7 +161,7 @@ var harness = {
* 'Auto-populate' button click handler.
*/
onPopulateClick: function() {
harness.importWebDirectory(this.filesystem,
harness.importWebDirectory(harness.filesystem,
'Downloads', 'harness_files', function() {}, harness.refreshDirectory);
},
......@@ -169,7 +169,7 @@ var harness = {
* Change handler for the 'input type=file' element.
*/
onFilesChange: function(event) {
this.importFiles(harness.filesystem,
harness.importFiles(harness.filesystem,
harness.fileManager.getCurrentDirectory(),
[].slice.call(event.target.files),
harness.refreshDirectory.bind(harness));
......
......@@ -68,7 +68,7 @@ chrome.fileBrowserPrivate = {
* --allow-file-access-from-files in order for this to work.
*/
requestLocalFileSystem: function(callback) {
window.webkitRequestFileSystem(this.FS_TYPE,
window.webkitRequestFileSystem(chrome.fileBrowserPrivate.FS_TYPE,
16 * 1024 * 1024, callback, util.ferr('Error requesting filesystem'));
},
......
......@@ -854,7 +854,7 @@ util.platform = {
* Close current window.
*/
closeWindow: function() {
if (this.v2()) {
if (util.platform.v2()) {
window.close();
} else {
chrome.tabs.getCurrent(function(tab) {
......@@ -867,7 +867,7 @@ util.platform = {
* @return {string} Applicaton id.
*/
getAppId: function() {
if (this.v2()) {
if (util.platform.v2()) {
return chrome.runtime.id;
} else {
return chrome.extension.getURL('').split('/')[2];
......@@ -879,7 +879,7 @@ util.platform = {
* @return {string} Extension-based URL.
*/
getURL: function(path) {
if (this.v2()) {
if (util.platform.v2()) {
return chrome.runtime.getURL(path);
} else {
return chrome.extension.getURL(path);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment