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

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

Issue 1025613002: Fix ESC not closing the print preview dialog on Mac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Clearer logic Created 5 years, 9 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
« no previous file with comments | « no previous file | 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 // TODO(rltoscano): Move data/* into print_preview.data namespace 5 // TODO(rltoscano): Move data/* into print_preview.data namespace
6 6
7 <include src="component.js"> 7 <include src="component.js">
8 <include src="print_preview_focus_manager.js"> 8 <include src="print_preview_focus_manager.js">
9 9
10 cr.define('print_preview', function() { 10 cr.define('print_preview', function() {
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after
865 * @param {KeyboardEvent} e The keyboard event. 865 * @param {KeyboardEvent} e The keyboard event.
866 * @private 866 * @private
867 * @suppress {uselessCode} 867 * @suppress {uselessCode}
868 * Current compiler preprocessor leaves all the code inside all the <if>s, 868 * Current compiler preprocessor leaves all the code inside all the <if>s,
869 * so the compiler claims that code after first return is unreachable. 869 * so the compiler claims that code after first return is unreachable.
870 */ 870 */
871 onKeyDown_: function(e) { 871 onKeyDown_: function(e) {
872 // Escape key closes the dialog. 872 // Escape key closes the dialog.
873 if (e.keyCode == 27 && !e.shiftKey && !e.ctrlKey && !e.altKey && 873 if (e.keyCode == 27 && !e.shiftKey && !e.ctrlKey && !e.altKey &&
874 !e.metaKey) { 874 !e.metaKey) {
875 <if expr="toolkit_views"> 875 // On non-mac with toolkit-views, ESC key is handled by C++-side instead
876 // On the toolkit_views environment, ESC key is handled by C++-side 876 // of JS-side.
877 // instead of JS-side. 877 if (cr.isMac) {
878 return; 878 this.close_();
879 </if> 879 e.preventDefault();
880 <if expr="not toolkit_views"> 880 }
881 this.close_();
882 </if>
883 e.preventDefault();
884 return; 881 return;
885 } 882 }
886 883
887 // On Mac, Cmd- should close the print dialog. 884 // On Mac, Cmd- should close the print dialog.
888 if (cr.isMac && e.keyCode == 189 && e.metaKey) { 885 if (cr.isMac && e.keyCode == 189 && e.metaKey) {
889 this.close_(); 886 this.close_();
890 e.preventDefault(); 887 e.preventDefault();
891 return; 888 return;
892 } 889 }
893 890
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
1315 <include src="search/cloud_destination_list.js"> 1312 <include src="search/cloud_destination_list.js">
1316 <include src="search/recent_destination_list.js"> 1313 <include src="search/recent_destination_list.js">
1317 <include src="search/destination_list_item.js"> 1314 <include src="search/destination_list_item.js">
1318 <include src="search/destination_search.js"> 1315 <include src="search/destination_search.js">
1319 <include src="search/fedex_tos.js"> 1316 <include src="search/fedex_tos.js">
1320 1317
1321 window.addEventListener('DOMContentLoaded', function() { 1318 window.addEventListener('DOMContentLoaded', function() {
1322 printPreview = new print_preview.PrintPreview(); 1319 printPreview = new print_preview.PrintPreview();
1323 printPreview.initialize(); 1320 printPreview.initialize();
1324 }); 1321 });
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698