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

Side by Side Diff: chrome/renderer/resources/extensions/omnibox_custom_bindings.js

Issue 10736024: Revert 146038 as it might have broken chromeos browser_tests - Make eventArgumentMassagers asynchro… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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 | Annotate | Revision Log
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 // Custom bindings for the omnibox API. Only injected into the v8 contexts 5 // Custom bindings for the omnibox API. Only injected into the v8 contexts
6 // for extensions which have permission for the omnibox API. 6 // for extensions which have permission for the omnibox API.
7 7
8 var chromeHidden = requireNative('chrome_hidden').GetChromeHidden(); 8 var chromeHidden = requireNative('chrome_hidden').GetChromeHidden();
9 var sendRequest = require('sendRequest').sendRequest; 9 var sendRequest = require('sendRequest').sendRequest;
10 10
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 'sendSuggestions', function(requestId, userSuggestions) { 90 'sendSuggestions', function(requestId, userSuggestions) {
91 var suggestions = []; 91 var suggestions = [];
92 for (var i = 0; i < userSuggestions.length; i++) { 92 for (var i = 0; i < userSuggestions.length; i++) {
93 var parseResult = parseOmniboxDescription( 93 var parseResult = parseOmniboxDescription(
94 userSuggestions[i].description); 94 userSuggestions[i].description);
95 parseResult.content = userSuggestions[i].content; 95 parseResult.content = userSuggestions[i].content;
96 suggestions.push(parseResult); 96 suggestions.push(parseResult);
97 } 97 }
98 return [requestId, suggestions]; 98 return [requestId, suggestions];
99 }); 99 });
100
101 chrome.omnibox.onInputChanged.dispatch =
102 function(text, requestId) {
103 var suggestCallback = function(suggestions) {
104 chrome.omnibox.sendSuggestions(requestId, suggestions);
105 };
106 chrome.Event.prototype.dispatch.apply(this, [text, suggestCallback]);
107 };
100 }); 108 });
101
102 chromeHidden.Event.registerArgumentMassager('omnibox.onInputChanged',
103 function(args, dispatch) {
104 var text = args[0];
105 var requestId = args[1];
106 var suggestCallback = function(suggestions) {
107 chrome.omnibox.sendSuggestions(requestId, suggestions);
108 };
109 dispatch([text, suggestCallback]);
110 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698