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 /* | 5 /* |
6 * Base class that Ribbon uses to display photos. | 6 * Base class that Ribbon uses to display photos. |
7 */ | 7 */ |
8 | 8 |
9 function RibbonClient() {} | 9 function RibbonClient() {} |
10 | 10 |
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 this.cancelFading_(); | 568 this.cancelFading_(); |
569 } else { | 569 } else { |
570 this.initiateFading_(); | 570 this.initiateFading_(); |
571 } | 571 } |
572 }; | 572 }; |
573 | 573 |
574 Gallery.prototype.onKeyDown_ = function(event) { | 574 Gallery.prototype.onKeyDown_ = function(event) { |
575 if (this.isEditing_() && this.editor_.onKeyDown(event)) | 575 if (this.isEditing_() && this.editor_.onKeyDown(event)) |
576 return; | 576 return; |
577 | 577 |
578 switch (event.keyIdentifier) { | 578 switch (util.getKeyModifiers(event) + event.keyIdentifier) { |
| 579 case 'U+0008': // Backspace. |
| 580 // The default handler would call history.back and close the Gallery. |
| 581 event.preventDefault(); |
| 582 break; |
| 583 |
579 case 'U+001B': // Escape | 584 case 'U+001B': // Escape |
580 if (this.isEditing_()) { | 585 if (this.isEditing_()) { |
581 this.onEdit_(); | 586 this.onEdit_(); |
582 } else if (this.isSharing_()) { | 587 } else if (this.isSharing_()) { |
583 this.onShare_(); | 588 this.onShare_(); |
584 } else { | 589 } else { |
585 this.onClose_(); | 590 this.onClose_(); |
586 } | 591 } |
587 break; | 592 break; |
588 | 593 |
(...skipping 15 matching lines...) Expand all Loading... |
604 case 'Left': | 609 case 'Left': |
605 this.ribbon_.selectNext(-1); | 610 this.ribbon_.selectNext(-1); |
606 break; | 611 break; |
607 case 'Right': | 612 case 'Right': |
608 this.ribbon_.selectNext(1); | 613 this.ribbon_.selectNext(1); |
609 break; | 614 break; |
610 case 'End': | 615 case 'End': |
611 this.ribbon_.selectLast(); | 616 this.ribbon_.selectLast(); |
612 break; | 617 break; |
613 | 618 |
614 case 'U+00DD': | 619 case 'Ctrl-U+00DD': // Ctrl+] (cryptic on purpose). |
615 if (event.ctrlKey) // Ctrl+] (cryptic on purpose). | 620 this.ribbon_.toggleDebugSlideshow(); |
616 this.ribbon_.toggleDebugSlideshow(); | |
617 break; | 621 break; |
618 } | 622 } |
619 }; | 623 }; |
620 | 624 |
621 Gallery.prototype.onMouseMove_ = function(e) { | 625 Gallery.prototype.onMouseMove_ = function(e) { |
622 if (this.clientX_ == e.clientX && this.clientY_ == e.clientY) { | 626 if (this.clientX_ == e.clientX && this.clientY_ == e.clientY) { |
623 // The mouse has not moved, must be the cursor change triggered by | 627 // The mouse has not moved, must be the cursor change triggered by |
624 // some of the attributes on the root container. Ignore the event. | 628 // some of the attributes on the root container. Ignore the event. |
625 return; | 629 return; |
626 } | 630 } |
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1257 ShareMode.prototype.setUp = function() { | 1261 ShareMode.prototype.setUp = function() { |
1258 ImageEditor.Mode.prototype.setUp.apply(this, arguments); | 1262 ImageEditor.Mode.prototype.setUp.apply(this, arguments); |
1259 ImageUtil.setAttribute(this.menu_, 'hidden', false); | 1263 ImageUtil.setAttribute(this.menu_, 'hidden', false); |
1260 ImageUtil.setAttribute(this.button_, 'pressed', false); | 1264 ImageUtil.setAttribute(this.button_, 'pressed', false); |
1261 }; | 1265 }; |
1262 | 1266 |
1263 ShareMode.prototype.cleanUpUI = function() { | 1267 ShareMode.prototype.cleanUpUI = function() { |
1264 ImageEditor.Mode.prototype.cleanUpUI.apply(this, arguments); | 1268 ImageEditor.Mode.prototype.cleanUpUI.apply(this, arguments); |
1265 ImageUtil.setAttribute(this.menu_, 'hidden', true); | 1269 ImageUtil.setAttribute(this.menu_, 'hidden', true); |
1266 }; | 1270 }; |
OLD | NEW |