- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / common / extensions / docs / examples / api / omnibox / simple-example / background.js
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
3 // found in the LICENSE file.
4
5 // This event is fired each time the user updates the text in the omnibox,
6 // as long as the extension's keyword mode is still active.
7 chrome.omnibox.onInputChanged.addListener(
8   function(text, suggest) {
9     console.log('inputChanged: ' + text);
10     suggest([
11       {content: text + " one", description: "the first one"},
12       {content: text + " number two", description: "the second entry"}
13     ]);
14   });
15
16 // This event is fired with the user accepts the input in the omnibox.
17 chrome.omnibox.onInputEntered.addListener(
18   function(text) {
19     console.log('inputEntered: ' + text);
20     alert('You just typed "' + text + '"');
21   });