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

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

Issue 128023002: [Files.app] Use 'activate' event on the view-change menuitems instead of 'click' event (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 11 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 | « no previous file | chrome/test/data/extensions/api_test/file_manager_browsertest/test_cases.js » ('j') | 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 'use strict'; 5 'use strict';
6 6
7 /** 7 /**
8 * FileManager constructor. 8 * FileManager constructor.
9 * 9 *
10 * FileManager objects encapsulate the functionality of the file selector 10 * FileManager objects encapsulate the functionality of the file selector
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 this.syncButton = this.dialogDom_.querySelector('#drive-sync-settings'); 802 this.syncButton = this.dialogDom_.querySelector('#drive-sync-settings');
803 this.syncButton.addEventListener('click', this.onDrivePrefClick_.bind( 803 this.syncButton.addEventListener('click', this.onDrivePrefClick_.bind(
804 this, 'cellularDisabled', false /* not inverted */)); 804 this, 'cellularDisabled', false /* not inverted */));
805 805
806 this.hostedButton = this.dialogDom_.querySelector('#drive-hosted-settings'); 806 this.hostedButton = this.dialogDom_.querySelector('#drive-hosted-settings');
807 this.hostedButton.addEventListener('click', this.onDrivePrefClick_.bind( 807 this.hostedButton.addEventListener('click', this.onDrivePrefClick_.bind(
808 this, 'hostedFilesDisabled', true /* inverted */)); 808 this, 'hostedFilesDisabled', true /* inverted */));
809 809
810 this.detailViewButton_ = 810 this.detailViewButton_ =
811 this.dialogDom_.querySelector('#detail-view'); 811 this.dialogDom_.querySelector('#detail-view');
812 this.detailViewButton_.addEventListener('click', 812 this.detailViewButton_.addEventListener('activate',
813 this.onDetailViewButtonClick_.bind(this)); 813 this.onDetailViewButtonClick_.bind(this));
814 814
815 this.thumbnailViewButton_ = 815 this.thumbnailViewButton_ =
816 this.dialogDom_.querySelector('#thumbnail-view'); 816 this.dialogDom_.querySelector('#thumbnail-view');
817 this.thumbnailViewButton_.addEventListener('click', 817 this.thumbnailViewButton_.addEventListener('activate',
818 this.onThumbnailViewButtonClick_.bind(this)); 818 this.onThumbnailViewButtonClick_.bind(this));
819 819
820 cr.ui.ComboButton.decorate(this.taskItems_); 820 cr.ui.ComboButton.decorate(this.taskItems_);
821 this.taskItems_.showMenu = function(shouldSetFocus) { 821 this.taskItems_.showMenu = function(shouldSetFocus) {
822 // Prevent the empty menu from opening. 822 // Prevent the empty menu from opening.
823 if (!this.menu.length) 823 if (!this.menu.length)
824 return; 824 return;
825 cr.ui.ComboButton.prototype.showMenu.call(this, shouldSetFocus); 825 cr.ui.ComboButton.prototype.showMenu.call(this, shouldSetFocus);
826 }; 826 };
827 this.taskItems_.addEventListener('select', 827 this.taskItems_.addEventListener('select',
(...skipping 1950 matching lines...) Expand 10 before | Expand all | Expand 10 after
2778 }; 2778 };
2779 2779
2780 tryCreate(); 2780 tryCreate();
2781 }; 2781 };
2782 2782
2783 /** 2783 /**
2784 * @param {Event} event Click event. 2784 * @param {Event} event Click event.
2785 * @private 2785 * @private
2786 */ 2786 */
2787 FileManager.prototype.onDetailViewButtonClick_ = function(event) { 2787 FileManager.prototype.onDetailViewButtonClick_ = function(event) {
2788 // Stop propagate and hide the menu manually, in order to prevent the focus
2789 // from being back to the button. (cf. http://crbug.com/248479)
2790 event.stopPropagation();
2791 this.gearButton_.hideMenu();
2792
2788 this.setListType(FileManager.ListType.DETAIL); 2793 this.setListType(FileManager.ListType.DETAIL);
2789 this.currentList_.focus(); 2794 this.currentList_.focus();
2790 }; 2795 };
2791 2796
2792 /** 2797 /**
2793 * @param {Event} event Click event. 2798 * @param {Event} event Click event.
2794 * @private 2799 * @private
2795 */ 2800 */
2796 FileManager.prototype.onThumbnailViewButtonClick_ = function(event) { 2801 FileManager.prototype.onThumbnailViewButtonClick_ = function(event) {
2802 // Stop propagate and hide the menu manually, in order to prevent the focus
2803 // from being back to the button. (cf. http://crbug.com/248479)
2804 event.stopPropagation();
2805 this.gearButton_.hideMenu();
2806
2797 this.setListType(FileManager.ListType.THUMBNAIL); 2807 this.setListType(FileManager.ListType.THUMBNAIL);
2798 this.currentList_.focus(); 2808 this.currentList_.focus();
2799 }; 2809 };
2800 2810
2801 /** 2811 /**
2802 * KeyDown event handler for the document. 2812 * KeyDown event handler for the document.
2803 * @param {Event} event Key event. 2813 * @param {Event} event Key event.
2804 * @private 2814 * @private
2805 */ 2815 */
2806 FileManager.prototype.onKeyDown_ = function(event) { 2816 FileManager.prototype.onKeyDown_ = function(event) {
(...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after
3649 callback(this.preferences_); 3659 callback(this.preferences_);
3650 return; 3660 return;
3651 } 3661 }
3652 3662
3653 chrome.fileBrowserPrivate.getPreferences(function(prefs) { 3663 chrome.fileBrowserPrivate.getPreferences(function(prefs) {
3654 this.preferences_ = prefs; 3664 this.preferences_ = prefs;
3655 callback(prefs); 3665 callback(prefs);
3656 }.bind(this)); 3666 }.bind(this));
3657 }; 3667 };
3658 })(); 3668 })();
OLDNEW
« no previous file with comments | « no previous file | chrome/test/data/extensions/api_test/file_manager_browsertest/test_cases.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698