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

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

Issue 10342010: Add gdata content search to file_manager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: style nits Created 8 years, 8 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 5a90e85a21a05b2c4340b3c36a55064155c6746b..dfc389059a6c882d8d5cec633bb424501332eed5 100644
--- a/chrome/browser/resources/file_manager/js/file_manager.js
+++ b/chrome/browser/resources/file_manager/js/file_manager.js
@@ -978,6 +978,8 @@ FileManager.prototype = {
*/
FileManager.prototype.canExecute_ = function(commandId) {
var readonly = this.isOnReadonlyDirectory();
+ var shouldCreate = !util.isSpecialReadonlyDirectory(
+ this.directoryModel_.getCurrentDirEntry().fullPath);
switch (commandId) {
case 'copy':
case 'cut':
@@ -985,7 +987,8 @@ FileManager.prototype = {
case 'paste':
return !!this.fileTransferController_ &&
- this.fileTransferController_.queryPasteCommandEnabled();
+ this.fileTransferController_.queryPasteCommandEnabled() &&
+ shouldCreate;
case 'rename':
return (// Initialized to the point where we have a current directory
@@ -1006,6 +1009,7 @@ FileManager.prototype = {
case 'newfolder':
return !readonly &&
+ shouldCreate &&
(this.dialogType_ == FileManager.DialogType.SELECT_SAVEAS_FILE ||
this.dialogType_ == FileManager.DialogType.FULL_PAGE);
@@ -1830,9 +1834,12 @@ FileManager.prototype = {
var fileName = this.document_.createElement('div');
fileName.className = 'filename-label';
+ var displayName =
+ this.directoryModel_.getDisplayName(entry.fullPath, entry.name);
+
fileName.textContent =
this.directoryModel_.getCurrentDirEntry().name == '' ?
- this.getRootLabel_(entry.name) : entry.name;
+ this.getRootLabel_(displayName) : displayName;
return fileName;
};
@@ -2860,18 +2867,23 @@ FileManager.prototype = {
var div = doc.createElement('div');
div.className = 'breadcrumb-path';
- div.textContent = i == 0 ? this.getRootLabel_(path) : pathName;
+ div.textContent = i == 0 ? this.getRootLabel_(path) :
SeRya 2012/05/07 14:06:00 You are going to show in breadcrumbs path like "gd
tbarzic 2012/05/10 03:20:47 With the newest version we will modifying breadcru
+ this.directoryModel_.getDisplayName(path,
+ pathName);
path = path + '/';
div.path = path;
bc.appendChild(div);
- if (i == pathNames.length - 1) {
- div.classList.add('breadcrumb-last');
+ if (i == pathNames.length - 1 ||
+ path == util.GDATA_SEARCH_ROOT_PATH + '/') {
+ div.classList.add('breadcrumb-non-clickable');
} else {
div.addEventListener('click', this.onBreadcrumbClick_.bind(this));
+ }
+ if (i != pathNames.length - 1) {
var spacer = doc.createElement('div');
spacer.className = 'separator';
bc.appendChild(spacer);
@@ -3378,10 +3390,17 @@ FileManager.prototype = {
this.updateBreadcrumbs_();
this.updateColumnModel_();
+ // We don't want to keep a record in browser history for each key press in
+ // the search box.
+ var shouldReplaceHistory =
SeRya 2012/05/07 14:06:00 I think when search query change DirectoryModel mu
tbarzic 2012/05/10 03:20:47 Done.
+ event.initial ||
+ (util.isSpecialReadonlyDirectory(event.newDirEntry.fullPath) &&
+ util.isSpecialReadonlyDirectory(event.previousDirEntry.fullPath));
+
// Sometimes we rescan the same directory (when mounting GData lazily first,
// then for real). Do not update the location then.
if (event.newDirEntry.fullPath != event.previousDirEntry.fullPath) {
- this.updateLocation_(event.initial, event.newDirEntry.fullPath);
+ this.updateLocation_(shouldReplaceHistory, event.newDirEntry.fullPath);
}
this.checkFreeSpace_(this.getCurrentDirectory());
@@ -3572,11 +3591,12 @@ FileManager.prototype = {
// case of success.
nameNode.textContent = newName;
- this.directoryModel_.doesExist(newName, function(exists, isFile) {
+ this.directoryModel_.doesExist(entry, newName, function(exists, isFile) {
if (!exists) {
this.directoryModel_.renameEntry(entry, newName, onError.bind(this));
} else {
- nameNode.textContent = entry.name;
+ nameNode.textContent =
+ this.directoryModel_.getDisplayName(entry.fullPath, entry.name);
var message = isFile ? 'FILE_ALREADY_EXISTS' :
'DIRECTORY_ALREADY_EXISTS';
this.alert.show(strf(message, newName));
@@ -4262,15 +4282,7 @@ FileManager.prototype = {
FileManager.prototype.onSearchBoxUpdate_ = function(event) {
var searchString = this.dialogDom_.querySelector('#search-box').value;
- if (searchString) {
- this.directoryModel_.addFilter(
- 'searchbox',
- function(e) {
- return e.name.substr(0, searchString.length) == searchString;
- });
- } else {
- this.directoryModel_.removeFilter('searchbox');
- }
+ this.directoryModel_.search(searchString);
};
FileManager.prototype.decorateSplitter = function(splitterElement) {

Powered by Google App Engine
This is Rietveld 408576698