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

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

Issue 11414140: [filemanager] Context menu command to pin/unpin file on Drive. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 1 month 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
===================================================================
--- chrome/browser/resources/file_manager/js/file_manager.js (revision 169329)
+++ chrome/browser/resources/file_manager/js/file_manager.js (working copy)
@@ -611,6 +611,9 @@
CommandUtil.registerCommand(doc, 'open-with',
Commands.openWithCommand, this);
+ CommandUtil.registerCommand(doc, 'available-offline',
Dmitry Zvorygin 2012/11/23 13:09:13 Consider using verbs, like "toggle-pinned".
dgozman 2012/11/23 13:13:38 Done.
+ Commands.availableOfflineCommand, this);
+
CommandUtil.registerCommand(doc, 'zip-selection',
Commands.zipSelectionCommand, this);
@@ -1906,6 +1909,7 @@
checkbox.addEventListener('click',
this.onPinClick_.bind(this, checkbox, entry));
checkbox.style.display = 'none';
+ checkbox.entry = entry;
div.appendChild(checkbox);
if (this.isOnGData()) {
@@ -2305,25 +2309,9 @@
};
FileManager.prototype.onPinClick_ = function(checkbox, entry, event) {
- // TODO(dgozman): revisit this method when gdata properties updated event
- // will be available.
- var self = this;
- var pin = checkbox.checked;
- function callback(props) {
- var fileProps = props[0];
- if (fileProps.errorCode && pin) {
- self.metadataCache_.get(entry, 'filesystem', function(filesystem) {
- self.alert.showHtml(str('GDATA_OUT_OF_SPACE_HEADER'),
- strf('GDATA_OUT_OF_SPACE_MESSAGE',
- unescape(entry.name),
- util.bytesToSi(filesystem.size)));
- });
- }
- // We don't have update events yet, so clear the cached data.
- self.metadataCache_.clear(entry, 'gdata');
- checkbox.checked = fileProps.isPinned;
- }
- chrome.fileBrowserPrivate.pinGDataFile([entry.toURL()], pin, callback);
+ var command = this.document_.querySelector('command#available-offline');
+ command.canExecuteChange(checkbox);
+ command.execute(checkbox);
event.preventDefault();
};

Powered by Google App Engine
This is Rietveld 408576698