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

Side by Side Diff: chrome/browser/resources/file_manager/js/file_manager.js

Issue 10094012: Made File Manager respect the user-selected launch type (tab/pinned tab/window/fullscreen) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Moved changes requiring external OWNERs approval to another patch 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/platform_util_chromeos.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // Setting the src of an img to an empty string can crash the browser, so we 5 // Setting the src of an img to an empty string can crash the browser, so we
6 // use an empty 1x1 gif instead. 6 // use an empty 1x1 gif instead.
7 7
8 /** 8 /**
9 * FileManager constructor. 9 * FileManager constructor.
10 * 10 *
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 // archive is mounted, but only for mounts from within this filebrowser tab. 519 // archive is mounted, but only for mounts from within this filebrowser tab.
520 this.mountRequests_ = []; 520 this.mountRequests_ = [];
521 this.unmountRequests_ = []; 521 this.unmountRequests_ = [];
522 chrome.fileBrowserPrivate.onMountCompleted.addListener( 522 chrome.fileBrowserPrivate.onMountCompleted.addListener(
523 this.onMountCompleted_.bind(this)); 523 this.onMountCompleted_.bind(this));
524 524
525 chrome.fileBrowserPrivate.onFileChanged.addListener( 525 chrome.fileBrowserPrivate.onFileChanged.addListener(
526 this.onFileChanged_.bind(this)); 526 this.onFileChanged_.bind(this));
527 527
528 var path = this.getPathFromUrlOrParams_(); 528 var path = this.getPathFromUrlOrParams_();
529 var invokeHandler = !this.params_.selectOnly;
529 if (path && 530 if (path &&
530 DirectoryModel.getRootType(path) == DirectoryModel.RootType.GDATA) { 531 DirectoryModel.getRootType(path) == DirectoryModel.RootType.GDATA) {
531 // We are opening on a GData path. Mount GData and show 532 // We are opening on a GData path. Mount GData and show
532 // "Loading Google Docs" message until the directory content loads. 533 // "Loading Google Docs" message until the directory content loads.
533 this.dialogContainer_.setAttribute('unmounted', true); 534 this.dialogContainer_.setAttribute('unmounted', true);
534 this.initGData_(true /* dirChanged */); 535 this.initGData_(true /* dirChanged */);
535 // This is a one-time handler (will be nulled out on the first call). 536 // This is a one-time handler (will be nulled out on the first call).
536 this.setupCurrentDirectoryPostponed_ = function(event) { 537 this.setupCurrentDirectoryPostponed_ = function(event) {
537 this.directoryModel_.removeEventListener('directory-changed', 538 this.directoryModel_.removeEventListener('directory-changed',
538 this.setupCurrentDirectoryPostponed_); 539 this.setupCurrentDirectoryPostponed_);
539 this.setupCurrentDirectoryPostponed_ = null; 540 this.setupCurrentDirectoryPostponed_ = null;
540 if (event) // If called as an event handler just exit silently. 541 if (event) // If called as an event handler just exit silently.
541 return; 542 return;
542 this.setupCurrentDirectory_(false /* blankWhileOpeningAFile */); 543 this.setupCurrentDirectory_(
544 invokeHandler, false /* blankWhileOpeningAFile */);
543 }.bind(this); 545 }.bind(this);
544 this.directoryModel_.addEventListener('directory-changed', 546 this.directoryModel_.addEventListener('directory-changed',
545 this.setupCurrentDirectoryPostponed_); 547 this.setupCurrentDirectoryPostponed_);
546 } else { 548 } else {
547 this.setupCurrentDirectory_(true /* blankWhileOpeningAFile */); 549 this.setupCurrentDirectory_(
550 invokeHandler, true /* blankWhileOpeningAFile */);
548 } 551 }
549 552
550 this.summarizeSelection_(); 553 this.summarizeSelection_();
551 554
552 var sortField = 555 var sortField =
553 window.localStorage['sort-field-' + this.dialogType_] || 'cachedMtime_'; 556 window.localStorage['sort-field-' + this.dialogType_] || 'cachedMtime_';
554 var sortDirection = 557 var sortDirection =
555 window.localStorage['sort-direction-' + this.dialogType_] || 'desc'; 558 window.localStorage['sort-direction-' + this.dialogType_] || 'desc';
556 this.directoryModel_.fileList.sort(sortField, sortDirection); 559 this.directoryModel_.fileList.sort(sortField, sortDirection);
557 560
(...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after
1553 return; 1556 return;
1554 } 1557 }
1555 }; 1558 };
1556 1559
1557 /** 1560 /**
1558 * Respond to the back and forward buttons. 1561 * Respond to the back and forward buttons.
1559 */ 1562 */
1560 FileManager.prototype.onPopState_ = function(event) { 1563 FileManager.prototype.onPopState_ = function(event) {
1561 // TODO(serya): We should restore selected items here. 1564 // TODO(serya): We should restore selected items here.
1562 this.closeFilePopup_(); 1565 this.closeFilePopup_();
1563 this.setupCurrentDirectory_(); 1566 this.setupCurrentDirectory_(true /* invokeHandler */);
1564 }; 1567 };
1565 1568
1566 FileManager.prototype.requestResize_ = function(timeout) { 1569 FileManager.prototype.requestResize_ = function(timeout) {
1567 setTimeout(this.onResize_.bind(this), timeout || 0); 1570 setTimeout(this.onResize_.bind(this), timeout || 0);
1568 }; 1571 };
1569 1572
1570 /** 1573 /**
1571 * Resize details and thumb views to fit the new window size. 1574 * Resize details and thumb views to fit the new window size.
1572 */ 1575 */
1573 FileManager.prototype.onResize_ = function() { 1576 FileManager.prototype.onResize_ = function() {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1607 }; 1610 };
1608 1611
1609 /** 1612 /**
1610 * Restores current directory and may be a selected item after page load (or 1613 * Restores current directory and may be a selected item after page load (or
1611 * reload) or popping a state (after click on back/forward). If location.hash 1614 * reload) or popping a state (after click on back/forward). If location.hash
1612 * is present it means that the user has navigated somewhere and that place 1615 * is present it means that the user has navigated somewhere and that place
1613 * will be restored. defaultPath primarily is used with save/open dialogs. 1616 * will be restored. defaultPath primarily is used with save/open dialogs.
1614 * Default path may also contain a file name. Freshly opened file manager 1617 * Default path may also contain a file name. Freshly opened file manager
1615 * window has neither. 1618 * window has neither.
1616 * 1619 *
1617 * @param {boolean} blankWhileOpeningAFile Whether to show fade over 1620 * @param {boolean} invokeHandler Whether to invoke the default handler on
1618 * the file manager. 1621 * the selected file.
1622 * @param {boolean} opt_blankWhileOpeningAFile Whether to show fade over
1623 * the file manager.
1619 */ 1624 */
1620 FileManager.prototype.setupCurrentDirectory_ = 1625 FileManager.prototype.setupCurrentDirectory_ =
1621 function(blankWhileOpeningAFile) { 1626 function(invokeHandler, opt_blankWhileOpeningAFile) {
1622 var path = this.getPathFromUrlOrParams_(); 1627 var path = this.getPathFromUrlOrParams_();
1623 1628
1624 if (!path) { 1629 if (!path) {
1625 this.directoryModel_.setupDefaultPath(); 1630 this.directoryModel_.setupDefaultPath();
1626 return; 1631 return;
1627 } 1632 }
1628 1633
1629 // In the FULL_PAGE mode if the hash path points to a file we might have 1634 // In the FULL_PAGE mode if the hash path points to a file we might have
1630 // to invoke a task after selecting it. 1635 // to invoke a task after selecting it.
1631 // If the file path is in params_ we only want to select the file. 1636 // If the file path is in params_ we only want to select the file.
1632 if (location.hash && 1637 if (invokeHandler && location.hash &&
1633 this.dialogType_ == FileManager.DialogType.FULL_PAGE) { 1638 this.dialogType_ == FileManager.DialogType.FULL_PAGE) {
1634 // To prevent the file list flickering for a moment before the action 1639 // To prevent the file list flickering for a moment before the action
1635 // is executed we hide it under a white div. 1640 // is executed we hide it under a white div.
1636 var shade; 1641 var shade;
1637 if (blankWhileOpeningAFile) { 1642 if (opt_blankWhileOpeningAFile) {
1638 shade = this.document_.createElement('div'); 1643 shade = this.document_.createElement('div');
1639 shade.className = 'overlay-pane'; 1644 shade.className = 'overlay-pane';
1640 shade.style.backgroundColor = 'white'; 1645 shade.style.backgroundColor = 'white';
1641 this.document_.body.appendChild(shade); 1646 this.document_.body.appendChild(shade);
1642 } 1647 }
1643 function removeShade() { 1648 function removeShade() {
1644 if (shade) 1649 if (shade)
1645 shade.parentNode.removeChild(shade); 1650 shade.parentNode.removeChild(shade);
1646 } 1651 }
1647 1652
(...skipping 2750 matching lines...) Expand 10 before | Expand all | Expand 10 after
4398 4403
4399 chrome.fileBrowserPrivate.setGDataPreferences(changeInfo); 4404 chrome.fileBrowserPrivate.setGDataPreferences(changeInfo);
4400 4405
4401 if (oldValue) { 4406 if (oldValue) {
4402 event.target.removeAttribute('checked'); 4407 event.target.removeAttribute('checked');
4403 } else { 4408 } else {
4404 event.target.setAttribute('checked', 'checked'); 4409 event.target.setAttribute('checked', 'checked');
4405 } 4410 }
4406 }; 4411 };
4407 })(); 4412 })();
OLDNEW
« no previous file with comments | « chrome/browser/platform_util_chromeos.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698