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 'use strict'; | 5 'use strict'; |
6 | 6 |
7 var CommandUtil = {}; | 7 var CommandUtil = {}; |
8 | 8 |
9 /** | 9 /** |
10 * Extracts root on which command event was dispatched. | 10 * Extracts root on which command event was dispatched. |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 selection.totalCount == 1; | 310 selection.totalCount == 1; |
311 } | 311 } |
312 }; | 312 }; |
313 | 313 |
314 /** | 314 /** |
315 * Opens drive help. | 315 * Opens drive help. |
316 */ | 316 */ |
317 Commands.volumeHelpCommand = { | 317 Commands.volumeHelpCommand = { |
318 execute: function() { | 318 execute: function() { |
319 if (fileManager.isOnDrive()) | 319 if (fileManager.isOnDrive()) |
320 window.open(FileManager.GOOGLE_DRIVE_HELP, 'help'); | 320 chrome.tabs.create({ url: FileManager.GOOGLE_DRIVE_HELP }); |
321 else | 321 else |
322 window.open(FileManager.FILES_APP_HELP, 'help'); | 322 chrome.tabs.create({ url: FileManager.FILES_APP_HELP }); |
323 }, | 323 }, |
324 canExecute: function(event, fileManager) { | 324 canExecute: function(event, fileManager) { |
325 event.canExecute = true; | 325 event.canExecute = true; |
326 } | 326 } |
327 }; | 327 }; |
328 | 328 |
329 /** | 329 /** |
330 * Opens drive buy-more-space url. | 330 * Opens drive buy-more-space url. |
331 */ | 331 */ |
332 Commands.driveBuySpaceCommand = { | 332 Commands.driveBuySpaceCommand = { |
333 execute: function() { | 333 execute: function() { |
334 window.open(FileManager.GOOGLE_DRIVE_BUY_STORAGE, 'buy-more-space'); | 334 chrome.tabs.create({ url: FileManager.GOOGLE_DRIVE_BUY_STORAGE }); |
335 }, | 335 }, |
336 canExecute: CommandUtil.canExecuteVisibleOnDriveOnly | 336 canExecute: CommandUtil.canExecuteVisibleOnDriveOnly |
337 }; | 337 }; |
338 | 338 |
339 /** | 339 /** |
340 * Clears drive cache. | 340 * Clears drive cache. |
341 */ | 341 */ |
342 Commands.driveClearCacheCommand = { | 342 Commands.driveClearCacheCommand = { |
343 execute: function() { | 343 execute: function() { |
344 chrome.fileBrowserPrivate.clearDriveCache(); | 344 chrome.fileBrowserPrivate.clearDriveCache(); |
345 }, | 345 }, |
346 canExecute: CommandUtil.canExecuteVisibleOnDriveWithCtrlKeyOnly | 346 canExecute: CommandUtil.canExecuteVisibleOnDriveWithCtrlKeyOnly |
347 }; | 347 }; |
348 | 348 |
349 /** | 349 /** |
350 * Reload the metadata of the file system from the server | 350 * Reload the metadata of the file system from the server |
351 */ | 351 */ |
352 Commands.driveReloadCommand = { | 352 Commands.driveReloadCommand = { |
353 execute: function() { | 353 execute: function() { |
354 chrome.fileBrowserPrivate.reloadDrive(); | 354 chrome.fileBrowserPrivate.reloadDrive(); |
355 }, | 355 }, |
356 canExecute: CommandUtil.canExecuteVisibleOnDriveWithCtrlKeyOnly | 356 canExecute: CommandUtil.canExecuteVisibleOnDriveWithCtrlKeyOnly |
357 }; | 357 }; |
358 | 358 |
359 /** | 359 /** |
360 * Opens drive.google.com. | 360 * Opens drive.google.com. |
361 */ | 361 */ |
362 Commands.driveGoToDriveCommand = { | 362 Commands.driveGoToDriveCommand = { |
363 execute: function() { | 363 execute: function() { |
364 window.open(FileManager.GOOGLE_DRIVE_ROOT, 'drive-root'); | 364 chrome.tabs.create({ url: FileManager.GOOGLE_DRIVE_ROOT }); |
365 }, | 365 }, |
366 canExecute: CommandUtil.canExecuteVisibleOnDriveOnly | 366 canExecute: CommandUtil.canExecuteVisibleOnDriveOnly |
367 }; | 367 }; |
368 | 368 |
369 /** | 369 /** |
370 * Displays open with dialog for current selection. | 370 * Displays open with dialog for current selection. |
371 */ | 371 */ |
372 Commands.openWithCommand = { | 372 Commands.openWithCommand = { |
373 execute: function(event, fileManager) { | 373 execute: function(event, fileManager) { |
374 var tasks = fileManager.getSelection().tasks; | 374 var tasks = fileManager.getSelection().tasks; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 fileManager.copyManager_.zipSelection(dirEntry, fileManager.isOnDrive(), | 467 fileManager.copyManager_.zipSelection(dirEntry, fileManager.isOnDrive(), |
468 selectionEntries); | 468 selectionEntries); |
469 }, | 469 }, |
470 canExecute: function(event, fileManager) { | 470 canExecute: function(event, fileManager) { |
471 var selection = fileManager.getSelection(); | 471 var selection = fileManager.getSelection(); |
472 event.canExecute = !fileManager.isOnReadonlyDirectory() && | 472 event.canExecute = !fileManager.isOnReadonlyDirectory() && |
473 !fileManager.isOnDrive() && | 473 !fileManager.isOnDrive() && |
474 selection && selection.totalCount > 0; | 474 selection && selection.totalCount > 0; |
475 } | 475 } |
476 }; | 476 }; |
OLD | NEW |