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

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

Issue 13779006: Fixed gear menu navigation using keyboard. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Replaced getElementById with querySelector Created 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/file_manager/js/file_manager.js
diff --git a/chrome/browser/resources/file_manager/js/file_manager.js b/chrome/browser/resources/file_manager/js/file_manager.js
index 4d735c5fd8d42ee67e6ccf7ca3d5ab1851c69e17..cb180bb590552e75e0ef699461688f0b59e9194e 100644
--- a/chrome/browser/resources/file_manager/js/file_manager.js
+++ b/chrome/browser/resources/file_manager/js/file_manager.js
@@ -63,6 +63,7 @@ function FileManager(dialogDom) {
DialogType.FULL_PAGE]);
this.selectionHandler_ = null;
+ this.ctrlKeyPressed_ = false;
this.metadataCache_ = MetadataCache.createFull();
this.volumeManager_ = VolumeManager.getInstance();
@@ -547,6 +548,9 @@ DialogType.isModal = function(type) {
false /* Without loading caption. */));
cr.ui.decorate(this.gearButton_, cr.ui.MenuButton);
+ this.dialogDom_.querySelector('#gear-menu').menuItemSelector =
+ 'menuitem, hr';
yoshiki 2013/04/09 08:41:36 Is this change necessary?
hirono 2013/04/09 22:55:48 These lines prevent inner elements of 'volume-spac
yoshiki 2013/04/10 03:51:29 Got it! thanks! On 2013/04/09 22:55:48, hirono wr
+
this.syncButton.checkable = true;
this.hostedButton.checkable = true;
};
@@ -1618,6 +1622,13 @@ DialogType.isModal = function(type) {
};
/**
+ * @return {boolean} True if the ctrl key is pressed now.
+ */
+ FileManager.prototype.isCtrlKeyPressed = function() {
+ return this.ctrlKeyPressed_;
+ };
+
+ /**
* @return {boolean} True if the "Available offline" column should be shown in
* the table layout.
*/
@@ -2036,6 +2047,8 @@ DialogType.isModal = function(type) {
FileManager.prototype.updateGearMenu_ = function() {
this.syncButton.hidden = !this.isOnDrive();
this.hostedButton.hidden = !this.isOnDrive();
+ this.document_.getElementById('drive-separator').hidden =
+ !this.isOnDrive();
yoshiki 2013/04/09 08:41:36 nit: 4 space indent.
hirono 2013/04/09 22:55:48 Done.
// If volume has changed, then fetch remaining space data.
if (this.previousRootUrl_ != this.directoryModel_.getCurrentRootUrl())
@@ -2516,7 +2529,7 @@ DialogType.isModal = function(type) {
switch (util.getKeyModifiers(event) + event.keyCode) {
case 'Ctrl-17': // Ctrl => Show hidden setting
- this.dialogDom_.setAttribute('ctrl-pressing', 'true');
+ this.setCtrlKeyPressed_(true);
return;
case 'Ctrl-190': // Ctrl-. => Toggle filter files.
@@ -2561,7 +2574,7 @@ DialogType.isModal = function(type) {
switch (util.getKeyModifiers(event) + event.keyCode) {
case '17': // Ctrl => Hide hidden setting
- this.dialogDom_.removeAttribute('ctrl-pressing');
+ this.setCtrlKeyPressed_(false);
return;
}
};
@@ -3409,4 +3422,15 @@ DialogType.isModal = function(type) {
callback(prefs);
}.bind(this));
};
+
+ /**
+ * Set the flag expressing whether the ctrl key is pressed or not.
+ * @param {boolean} flag New value of the flag
+ * @private
+ */
+ FileManager.prototype.setCtrlKeyPressed_ = function(flag) {
+ this.ctrlKeyPressed_ = flag;
+ this.document_.querySelector('#drive-clear-local-cache').canExecuteChange();
+ this.document_.querySelector('#drive-reload').canExecuteChange();
+ };
})();

Powered by Google App Engine
This is Rietveld 408576698