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

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

Issue 14592004: Merge 199135 "Fix mismatched parameter expectations between chro..." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1500/src/
Patch Set: Created 7 years, 7 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
« no previous file with comments | « chrome/common/extensions/api/omnibox.json ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 binding for the omnibox API. Only injected into the v8 contexts 5 // Custom binding 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 binding = require('binding').Binding.create('omnibox'); 8 var binding = require('binding').Binding.create('omnibox');
9 9
10 var chromeHidden = requireNative('chrome_hidden').GetChromeHidden(); 10 var chromeHidden = requireNative('chrome_hidden').GetChromeHidden();
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 83
84 binding.registerCustomHook(function(bindingsAPI) { 84 binding.registerCustomHook(function(bindingsAPI) {
85 var apiFunctions = bindingsAPI.apiFunctions; 85 var apiFunctions = bindingsAPI.apiFunctions;
86 86
87 apiFunctions.setUpdateArgumentsPreValidate('setDefaultSuggestion', 87 apiFunctions.setUpdateArgumentsPreValidate('setDefaultSuggestion',
88 function(suggestResult) { 88 function(suggestResult) {
89 if (suggestResult.content != undefined) { // null, etc. 89 if (suggestResult.content != undefined) { // null, etc.
90 throw new Error( 90 throw new Error(
91 'setDefaultSuggestion cannot contain the "content" field'); 91 'setDefaultSuggestion cannot contain the "content" field');
92 } 92 }
93 suggestResult.content = '';
94 return [suggestResult]; 93 return [suggestResult];
95 }); 94 });
96 95
97 apiFunctions.setHandleRequest('setDefaultSuggestion', function(details) { 96 apiFunctions.setHandleRequest('setDefaultSuggestion', function(details) {
98 var parseResult = parseOmniboxDescription(details.description); 97 var parseResult = parseOmniboxDescription(details.description);
99 sendRequest(this.name, [parseResult], this.definition.parameters); 98 sendRequest(this.name, [parseResult], this.definition.parameters);
100 }); 99 });
101 100
102 apiFunctions.setUpdateArgumentsPostValidate( 101 apiFunctions.setUpdateArgumentsPostValidate(
103 'sendSuggestions', function(requestId, userSuggestions) { 102 'sendSuggestions', function(requestId, userSuggestions) {
(...skipping 12 matching lines...) Expand all
116 function(args, dispatch) { 115 function(args, dispatch) {
117 var text = args[0]; 116 var text = args[0];
118 var requestId = args[1]; 117 var requestId = args[1];
119 var suggestCallback = function(suggestions) { 118 var suggestCallback = function(suggestions) {
120 chrome.omnibox.sendSuggestions(requestId, suggestions); 119 chrome.omnibox.sendSuggestions(requestId, suggestions);
121 }; 120 };
122 dispatch([text, suggestCallback]); 121 dispatch([text, suggestCallback]);
123 }); 122 });
124 123
125 exports.binding = binding.generate(); 124 exports.binding = binding.generate();
OLDNEW
« no previous file with comments | « chrome/common/extensions/api/omnibox.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698