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

Side by Side Diff: ui/webui/resources/js/cr/link_controller.js

Issue 2104103002: Convert Event#keyIdentifier (deprecated) to Event#key (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Patch file manager test Created 4 years, 5 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 | « ui/webui/resources/js/action_link.js ('k') | ui/webui/resources/js/cr/ui/autocomplete_list.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 /** 5 /**
6 * @fileoverview This file provides a class that can be used to open URLs based 6 * @fileoverview This file provides a class that can be used to open URLs based
7 * on user interactions. It ensures a consistent behavior when it comes to 7 * on user interactions. It ensures a consistent behavior when it comes to
8 * holding down Ctrl and Shift while clicking or activating the a link. 8 * holding down Ctrl and Shift while clicking or activating the a link.
9 * 9 *
10 * This depends on the {@code chrome.windows} and {@code chrome.tabs} 10 * This depends on the {@code chrome.windows} and {@code chrome.tabs}
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 return this.localStrings_.getStringF('should_open_all', String(count)); 74 return this.localStrings_.getStringF('should_open_all', String(count));
75 }, 75 },
76 76
77 /** 77 /**
78 * Open an URL from a mouse or keyboard event. 78 * Open an URL from a mouse or keyboard event.
79 * @param {string} url The URL to open. 79 * @param {string} url The URL to open.
80 * @param {!Event} e The event triggering the opening of the URL. 80 * @param {!Event} e The event triggering the opening of the URL.
81 */ 81 */
82 openUrlFromEvent: function(url, e) { 82 openUrlFromEvent: function(url, e) {
83 // We only support keydown Enter and non right click events. 83 // We only support keydown Enter and non right click events.
84 if (e.type == 'keydown' && e.keyIdentifier == 'Enter' || 84 if (e.type == 'keydown' && e.key == 'Enter' || e.button != 2) {
85 e.button != 2) {
86 var kind; 85 var kind;
87 var ctrl = cr.isMac && e.metaKey || !cr.isMac && e.ctrlKey; 86 var ctrl = cr.isMac && e.metaKey || !cr.isMac && e.ctrlKey;
88 87
89 if (e.button == 1 || ctrl) // middle, ctrl or keyboard 88 if (e.button == 1 || ctrl) // middle, ctrl or keyboard
90 kind = e.shiftKey ? cr.LinkKind.FOREGROUND_TAB : 89 kind = e.shiftKey ? cr.LinkKind.FOREGROUND_TAB :
91 cr.LinkKind.BACKGROUND_TAB; 90 cr.LinkKind.BACKGROUND_TAB;
92 else // left or keyboard 91 else // left or keyboard
93 kind = e.shiftKey ? cr.LinkKind.WINDOW : cr.LinkKind.SELF; 92 kind = e.shiftKey ? cr.LinkKind.WINDOW : cr.LinkKind.SELF;
94 93
95 this.openUrls([url], kind); 94 this.openUrls([url], kind);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 this.window.location.href = urls[0]; 144 this.window.location.href = urls[0];
146 } 145 }
147 } 146 }
148 }; 147 };
149 148
150 // Export 149 // Export
151 return { 150 return {
152 LinkController: LinkController, 151 LinkController: LinkController,
153 }; 152 };
154 }); 153 });
OLDNEW
« no previous file with comments | « ui/webui/resources/js/action_link.js ('k') | ui/webui/resources/js/cr/ui/autocomplete_list.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698