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

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

Issue 10446076: Handle Escape key on constrained window. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 8 years, 6 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
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 // TODO(rltoscano): Move data/* into print_preview.data namespace 5 // TODO(rltoscano): Move data/* into print_preview.data namespace
6 6
7 var localStrings = new LocalStrings(templateData); 7 var localStrings = new LocalStrings(templateData);
8 8
9 <include src="component.js"/> 9 <include src="component.js"/>
10 10
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 }, 618 },
619 619
620 /** 620 /**
621 * Consume escape key presses and ctrl + shift + p. Delegate everything else 621 * Consume escape key presses and ctrl + shift + p. Delegate everything else
622 * to the preview area. 622 * to the preview area.
623 * @param {KeyboardEvent} e The keyboard event. 623 * @param {KeyboardEvent} e The keyboard event.
624 * @private 624 * @private
625 */ 625 */
626 onKeyDown_: function(e) { 626 onKeyDown_: function(e) {
627 // Escape key closes the dialog. 627 // Escape key closes the dialog.
628 // <if expr="not pp_ifdef('toolkit_views')">
629 // On the toolkit_views environment, ESC key is handled by C++-side
630 // instead of JS-side.
628 if (e.keyCode == 27 && !e.shiftKey && !e.ctrlKey && !e.altKey && 631 if (e.keyCode == 27 && !e.shiftKey && !e.ctrlKey && !e.altKey &&
629 !e.metaKey) { 632 !e.metaKey) {
630 if (this.destinationSearch_.getIsVisible()) { 633 if (this.destinationSearch_.getIsVisible()) {
631 this.destinationSearch_.setIsVisible(false); 634 this.destinationSearch_.setIsVisible(false);
632 this.metrics_.increment( 635 this.metrics_.increment(
633 print_preview.Metrics.Bucket.DESTINATION_SELECTION_CANCELED); 636 print_preview.Metrics.Bucket.DESTINATION_SELECTION_CANCELED);
634 } else { 637 } else {
635 this.close_(); 638 this.close_();
636 } 639 }
637 e.preventDefault(); 640 e.preventDefault();
638 return; 641 return;
639 } 642 }
643 // </if>
640 644
641 // Ctrl + Shift + p / Mac equivalent. 645 // Ctrl + Shift + p / Mac equivalent.
642 if (e.keyCode == 80) { 646 if (e.keyCode == 80) {
643 if ((cr.isMac && e.metaKey && e.altKey && !e.shiftKey && !e.ctrlKey) || 647 if ((cr.isMac && e.metaKey && e.altKey && !e.shiftKey && !e.ctrlKey) ||
644 (!cr.isMac && e.shiftKey && e.ctrlKey && !e.altKey && !e.metaKey)) { 648 (!cr.isMac && e.shiftKey && e.ctrlKey && !e.altKey && !e.metaKey)) {
645 this.openSystemPrintDialog_(); 649 this.openSystemPrintDialog_();
646 e.preventDefault(); 650 e.preventDefault();
647 return; 651 return;
648 } 652 }
649 } 653 }
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 <include src="search/cloud_destination_list.js"/> 802 <include src="search/cloud_destination_list.js"/>
799 <include src="search/destination_list_item.js"/> 803 <include src="search/destination_list_item.js"/>
800 <include src="search/destination_search.js"/> 804 <include src="search/destination_search.js"/>
801 <include src="search/search_box.js"/> 805 <include src="search/search_box.js"/>
802 <include src="search/fedex_tos.js"/> 806 <include src="search/fedex_tos.js"/>
803 807
804 window.addEventListener('DOMContentLoaded', function() { 808 window.addEventListener('DOMContentLoaded', function() {
805 printPreview = new print_preview.PrintPreview(); 809 printPreview = new print_preview.PrintPreview();
806 printPreview.initialize(); 810 printPreview.initialize();
807 }); 811 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/certificate_viewer.js ('k') | chrome/browser/ui/views/constrained_web_dialog_delegate_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698