OLD | NEW |
---|---|
(Empty) | |
1 /** | |
2 * @fileoverview Embedded Search API implementation for testing. | |
3 */ | |
4 | |
5 var apiHandle; | |
6 var onnativesuggestioncalls = 0; | |
7 var onsubmitcalls = 0; | |
8 | |
9 function getApiHandle() { | |
10 if (window.navigator && window.navigator.searchBox) | |
11 return window.navigator.searchBox; | |
12 if (window.chrome && window.chrome.searchBox) | |
13 return window.chrome.searchBox; | |
14 return null; | |
15 } | |
16 | |
17 function handleNativeSuggestions() { | |
18 console.log('native'); | |
sreeram
2013/01/17 23:54:18
Remove this? (I assume you added it for debugging.
samarth
2013/01/18 00:06:45
Done.
| |
19 onnativesuggestioncalls++; | |
20 apiHandle.show(2 /* QUERY_SUGGESTIONS */, 300); | |
21 } | |
22 | |
23 function handleSubmit() { | |
24 onsubmitcalls++; | |
25 } | |
26 | |
27 function setUp() { | |
28 apiHandle = getApiHandle(); | |
29 apiHandle.onnativesuggestions = handleNativeSuggestions; | |
30 apiHandle.onsubmit = handleSubmit; | |
31 if (apiHandle.value) | |
32 handleNativeSuggestions(); | |
33 } | |
34 | |
35 setUp(); | |
OLD | NEW |