| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 var CommandUtil = {}; | 5 var CommandUtil = {}; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Extracts root on which command event was dispatched. | 8 * Extracts root on which command event was dispatched. |
| 9 * | 9 * |
| 10 * @param {Event} event Command event for which to retrieve root to operate on. | 10 * @param {Event} event Command event for which to retrieve root to operate on. |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 if (fileProps.errorCode && pin) { | 344 if (fileProps.errorCode && pin) { |
| 345 fileManager.metadataCache_.get(entry, 'filesystem', showError); | 345 fileManager.metadataCache_.get(entry, 'filesystem', showError); |
| 346 } | 346 } |
| 347 // We don't have update events yet, so clear the cached data. | 347 // We don't have update events yet, so clear the cached data. |
| 348 fileManager.metadataCache_.clear(entry, 'gdata'); | 348 fileManager.metadataCache_.clear(entry, 'gdata'); |
| 349 fileManager.metadataCache_.get(entry, 'gdata', function(gdata) { | 349 fileManager.metadataCache_.get(entry, 'gdata', function(gdata) { |
| 350 fileManager.updateMetadataInUI_('gdata', [entry.toURL()], [gdata]); | 350 fileManager.updateMetadataInUI_('gdata', [entry.toURL()], [gdata]); |
| 351 }); | 351 }); |
| 352 } | 352 } |
| 353 | 353 |
| 354 chrome.fileBrowserPrivate.pinGDataFile([entry.toURL()], pin, callback); | 354 chrome.fileBrowserPrivate.pinDriveFile([entry.toURL()], pin, callback); |
| 355 }, | 355 }, |
| 356 canExecute: function(event, fileManager) { | 356 canExecute: function(event, fileManager) { |
| 357 var entry = CommandUtil.getSingleEntry(event, fileManager); | 357 var entry = CommandUtil.getSingleEntry(event, fileManager); |
| 358 var gdata = entry && fileManager.metadataCache_.getCached(entry, 'gdata'); | 358 var gdata = entry && fileManager.metadataCache_.getCached(entry, 'gdata'); |
| 359 | 359 |
| 360 if (!fileManager.isOnGData() || entry.isDirectory || !gdata || | 360 if (!fileManager.isOnGData() || entry.isDirectory || !gdata || |
| 361 gdata.hosted) { | 361 gdata.hosted) { |
| 362 event.canExecute = false; | 362 event.canExecute = false; |
| 363 event.command.setHidden(true); | 363 event.command.setHidden(true); |
| 364 } else { | 364 } else { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 378 var selectionEntries = fileManager.getSelection().entries; | 378 var selectionEntries = fileManager.getSelection().entries; |
| 379 fileManager.copyManager_.zipSelection(dirEntry, fileManager.isOnGData(), | 379 fileManager.copyManager_.zipSelection(dirEntry, fileManager.isOnGData(), |
| 380 selectionEntries); | 380 selectionEntries); |
| 381 }, | 381 }, |
| 382 canExecute: function(event, fileManager) { | 382 canExecute: function(event, fileManager) { |
| 383 var selection = fileManager.getSelection(); | 383 var selection = fileManager.getSelection(); |
| 384 event.canExecute = !fileManager.isOnGData() && selection && | 384 event.canExecute = !fileManager.isOnGData() && selection && |
| 385 selection.totalCount > 0; | 385 selection.totalCount > 0; |
| 386 } | 386 } |
| 387 }; | 387 }; |
| OLD | NEW |