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

Unified Diff: chrome/browser/resources/shared/js/cr/link_controller.js

Issue 6332020: BMM: Handle middle click correctly. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix typo Created 9 years, 11 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
« no previous file with comments | « chrome/browser/resources/bookmark_manager/js/bmm/bookmark_list.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/shared/js/cr/link_controller.js
diff --git a/chrome/browser/resources/shared/js/cr/link_controller.js b/chrome/browser/resources/shared/js/cr/link_controller.js
index 07e323f764f8c5ae5f4e641741c5387e4a076b16..27fc1c0c70a889fc57ce8da2f9baf9d03ff6d696 100644
--- a/chrome/browser/resources/shared/js/cr/link_controller.js
+++ b/chrome/browser/resources/shared/js/cr/link_controller.js
@@ -82,22 +82,18 @@ cr.define('cr', function() {
*/
openUrlFromEvent: function(url, e) {
// We only support keydown Enter and non right click events.
- if (e.type == 'keydown') {
- if(e.keyIdentifier != 'Enter')
- return;
- } else if (e.type != 'click' || e.button == 2) {
- return;
- }
+ if (e.type == 'keydown' && e.keyIdentifier == 'Enter' ||
+ e.button != 2) {
+ var kind;
+ var ctrl = cr.isMac && e.metaKey || !cr.isMac && e.ctrlKey;
- var kind;
- var ctrl = cr.isMac && e.metaKey || !cr.isMac && e.ctrlKey;
+ if (e.button == 1 || ctrl) // middle, ctrl or keyboard
+ kind = e.shiftKey ? LinkKind.FOREGROUND_TAB : LinkKind.BACKGROUND_TAB;
+ else // left or keyboard
+ kind = e.shiftKey ? LinkKind.WINDOW : LinkKind.SELF;
- if (e.button == 1 || ctrl) // middle, ctrl or keyboard
- kind = e.shiftKey ? LinkKind.FOREGROUND_TAB : LinkKind.BACKGROUND_TAB;
- else // left or keyboard
- kind = e.shiftKey ? LinkKind.WINDOW : LinkKind.SELF;
-
- this.openUrls([url], kind);
+ this.openUrls([url], kind);
+ }
},
« no previous file with comments | « chrome/browser/resources/bookmark_manager/js/bmm/bookmark_list.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698