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

Unified Diff: chrome/browser/resources/local_omnibox_popup/local_omnibox_popup.js

Issue 11644009: Added support for passing WindowOpenDisposition into BrowserInstantController::OpenURL() from the o… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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/instant/instant_page.cc ('k') | chrome/browser/ui/browser_instant_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/local_omnibox_popup/local_omnibox_popup.js
diff --git a/chrome/browser/resources/local_omnibox_popup/local_omnibox_popup.js b/chrome/browser/resources/local_omnibox_popup/local_omnibox_popup.js
index c80c0aa1e75e1be1e8177fa8b30a67d080b7dff4..f35152372b80aa78b4f7b0f3e85c9348337e9e7e 100644
--- a/chrome/browser/resources/local_omnibox_popup/local_omnibox_popup.js
+++ b/chrome/browser/resources/local_omnibox_popup/local_omnibox_popup.js
@@ -2,6 +2,33 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+/**
+ * @fileoverview Support for omnibox behavior in offline mode or when API
+ * features are not supported on the server.
+ */
+
+// ==========================================================
+// Enums.
+// ==========================================================
+
+/**
+ * Possible behaviors for navigateContentWindow.
+ * @enum {number}
+ * @private
+ */
+var WindowOpenDisposition_ = {
Evan Stade 2013/02/22 22:28:29 why are there trailing underscores here and below?
dougw 2013/02/22 23:32:19 Unless I'm mistaken (and that's very possible), th
+ CURRENT_TAB: 1,
+ NEW_BACKGROUND_TAB: 2
+};
+
+/**
+ * The JavaScript button event value for a middle click.
+ * @type {number}
+ * @private
+ * @const
+ */
+var MIDDLE_MOUSE_BUTTON_ = 1;
+
// =============================================================================
// Util functions
// =============================================================================
@@ -53,8 +80,8 @@ function addSuggestionToBox(suggestion, box, select) {
contentsContainer.appendChild(contents);
suggestionDiv.appendChild(contentsContainer);
var restrictedId = suggestion.rid;
- suggestionDiv.onclick = function() {
- handleSuggestionClick(restrictedId);
+ suggestionDiv.onclick = function(event) {
+ handleSuggestionClick(restrictedId, event);
};
restrictedIds.push(restrictedId);
@@ -196,10 +223,14 @@ function appendSuggestionStyles() {
* Handles suggestion clicks.
* @param {integer} restrictedId The restricted id of the suggestion being
* clicked.
+ * @param {Event} event The native click event.
Evan Stade 2013/02/22 22:28:29 not sure what "native" means in this context. Sugg
dougw 2013/02/22 23:32:19 Done.
*/
-function handleSuggestionClick(restrictedId) {
+function handleSuggestionClick(restrictedId, event) {
clearSuggestions();
- getApiObjectHandle().navigateContentWindow(restrictedId);
+ var disposition = WindowOpenDisposition_.CURRENT_TAB;
+ if (event.button == MIDDLE_MOUSE_BUTTON_)
+ disposition = WindowOpenDisposition_.NEW_BACKGROUND_TAB;
+ getApiObjectHandle().navigateContentWindow(restrictedId, disposition);
}
/**
« no previous file with comments | « chrome/browser/instant/instant_page.cc ('k') | chrome/browser/ui/browser_instant_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698