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

Unified Diff: chrome/browser/resources/local_ntp/window_disposition_util.js

Issue 178253008: Redoing Issue 36073011: Allowing file:/// in Instant Extended's Most Visited links. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove unused consts. Created 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/local_ntp/window_disposition_util.js
diff --git a/chrome/browser/resources/local_ntp/window_disposition_util.js b/chrome/browser/resources/local_ntp/window_disposition_util.js
new file mode 100644
index 0000000000000000000000000000000000000000..9282759560ec7501be5ad322bd27af1bc28940ab
--- /dev/null
+++ b/chrome/browser/resources/local_ntp/window_disposition_util.js
@@ -0,0 +1,32 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+
+/**
+ * @fileoverview Utilities for handling window disposition.
+ */
+
+
+/**
+ * The JavaScript button event value for a middle click.
+ * @type {number}
+ * @const
+ */
+var MIDDLE_MOUSE_BUTTON = 1;
+
+
+/**
+ * Gets the desired navigation behavior from a event. This function works both
+ * with mouse and keyboard events.
+ * @param {Event} e The event object.
+ * @return {WindowOpenDisposition} The desired navigation behavior.
+ */
+function getDispositionFromEvent(e) {
+ var middleButton = e.button == MIDDLE_MOUSE_BUTTON;
+ return chrome.embeddedSearch.newTabPage.getDispositionFromClick(middleButton,
+ e.altKey,
+ e.ctrlKey,
+ e.metaKey,
+ e.shiftKey);
+}

Powered by Google App Engine
This is Rietveld 408576698