15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved. 25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file. 45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// This event is fired each time the user updates the text in the omnibox, 65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// as long as the extension's keyword mode is still active. 75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)chrome.omnibox.onInputChanged.addListener( 85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) function(text, suggest) { 95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) console.log('inputChanged: ' + text); 105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) suggest([ 115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) {content: text + " one", description: "the first one"}, 125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) {content: text + " number two", description: "the second entry"} 135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) ]); 145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) }); 155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// This event is fired with the user accepts the input in the omnibox. 175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)chrome.omnibox.onInputEntered.addListener( 185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) function(text) { 195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) console.log('inputEntered: ' + text); 205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) alert('You just typed "' + text + '"'); 215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) }); 22