Index: chrome/browser/resources/local_ntp/local_ntp.js |
diff --git a/chrome/browser/resources/local_ntp/local_ntp.js b/chrome/browser/resources/local_ntp/local_ntp.js |
index 013cb0e20acf6dbab29b1969b5d4ea8785eab44f..fb8b873216619a004c19a623ce170a4cb6d0796b 100644 |
--- a/chrome/browser/resources/local_ntp/local_ntp.js |
+++ b/chrome/browser/resources/local_ntp/local_ntp.js |
@@ -7,13 +7,14 @@ |
* @fileoverview The local InstantExtended NTP. |
*/ |
+ |
/** |
* Controls rendering the new tab page for InstantExtended. |
* @return {Object} A limited interface for testing the local NTP. |
*/ |
function LocalNTP() { |
<include src="../../../../ui/webui/resources/js/assert.js"> |
- |
+<include src="window_disposition_util.js"> |
/** |
@@ -101,16 +102,6 @@ var MIDDLE_MOUSE_BUTTON = 1; |
/** |
- * Possible behaviors for navigateContentWindow. |
- * @enum {number} |
- */ |
-var WindowOpenDisposition = { |
- CURRENT_TAB: 1, |
- NEW_BACKGROUND_TAB: 2 |
-}; |
- |
- |
-/** |
* The container for the tile elements. |
* @type {Element} |
*/ |
@@ -542,8 +533,9 @@ function createTile(page, position) { |
var rid = page.rid; |
tileElement.classList.add(CLASSES.PAGE); |
- var navigateFunction = function() { |
- ntpApiHandle.navigateContentWindow(rid); |
+ var navigateFunction = function(e) { |
+ e.preventDefault(); |
+ ntpApiHandle.navigateContentWindow(rid, getDispositionFromEvent(e)); |
}; |
// The click handler for navigating to the page identified by the RID. |
@@ -920,18 +912,6 @@ function getEmbeddedSearchApiHandle() { |
return null; |
} |
-/** |
- * Extract the desired navigation behavior from a click button. |
- * @param {number} button The Event#button property of a click event. |
- * @return {WindowOpenDisposition} The desired behavior for |
- * navigateContentWindow. |
- */ |
-function getDispositionFromClickButton(button) { |
- if (button == MIDDLE_MOUSE_BUTTON) |
- return WindowOpenDisposition.NEW_BACKGROUND_TAB; |
- return WindowOpenDisposition.CURRENT_TAB; |
-} |
- |
/** |
* Prepares the New Tab Page by adding listeners, rendering the current |