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

Side by Side Diff: chrome/test/data/instant_extended.html

Issue 13141002: Use Instant suggested match type for Instant temporary text. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 <html> 1 <html>
2 <head> 2 <head>
3 <script> 3 <script>
4 4
5 var apiHandle; 5 var apiHandle;
6 var newTabPageHandle; 6 var newTabPageHandle;
7 var savedUserText = null; 7 var savedUserText = null;
8 var suggestionIndex = -1; 8 var suggestionIndex = -1;
9 var suggestions = ["result 1", "result 2", "result 3"]; 9 var suggestions = ["result 1", "result 2", "result 3"];
10 var suggestion; 10 var suggestion;
11 var behavior = 2; 11 var suggestionType = 0; // INSTANT_SUGGESTION_SEARCH
12 var behavior = 2; // INSTANT_COMPLETE_NEVER
12 var onMostVisitedChangedCalls = 0; 13 var onMostVisitedChangedCalls = 0;
13 var mostVisitedItemsCount = 0; 14 var mostVisitedItemsCount = 0;
14 var firstMostVisitedItemId = 0; 15 var firstMostVisitedItemId = 0;
15 var onNativeSuggestionsCalls = 0; 16 var onNativeSuggestionsCalls = 0;
16 var onChangeCalls = 0; 17 var onChangeCalls = 0;
17 18
18 function getApiHandle() { 19 function getApiHandle() {
19 if (window.navigator && window.navigator.searchBox) 20 if (window.navigator && window.navigator.searchBox)
20 return window.navigator.searchBox; 21 return window.navigator.searchBox;
21 if (window.chrome && window.chrome.searchBox) 22 if (window.chrome && window.chrome.searchBox)
(...skipping 28 matching lines...) Expand all
50 if (suggestion) { 51 if (suggestion) {
51 apiHandle.setAutocompleteText(suggestion, behavior); 52 apiHandle.setAutocompleteText(suggestion, behavior);
52 // Ensure this is only called once for this suggestion. 53 // Ensure this is only called once for this suggestion.
53 suggestion = null; 54 suggestion = null;
54 } 55 }
55 } 56 }
56 57
57 function nextSuggestion() { 58 function nextSuggestion() {
58 if (suggestionIndex < suggestions.length - 1) { 59 if (suggestionIndex < suggestions.length - 1) {
59 suggestionIndex++; 60 suggestionIndex++;
60 apiHandle.setValue(suggestions[suggestionIndex]); 61 apiHandle.setValue(suggestions[suggestionIndex], suggestionType);
61 } 62 }
62 } 63 }
63 64
64 function previousSuggestion() { 65 function previousSuggestion() {
65 if (suggestionIndex != -1) { 66 if (suggestionIndex != -1) {
66 suggestionIndex--; 67 suggestionIndex--;
67 if (suggestionIndex == -1) { 68 if (suggestionIndex == -1) {
68 apiHandle.setValue(savedUserText); 69 apiHandle.setValue(savedUserText, suggestionType);
69 } else { 70 } else {
70 apiHandle.setValue(suggestions[suggestionIndex]); 71 apiHandle.setValue(suggestions[suggestionIndex], suggestionType);
71 } 72 }
72 } 73 }
73 } 74 }
74 75
75 function handleKeyPress(event) { 76 function handleKeyPress(event) {
76 var VKEY_UP = 0x26; 77 var VKEY_UP = 0x26;
77 var VKEY_DOWN = 0x28; 78 var VKEY_DOWN = 0x28;
78 79
79 if (event.keyCode == VKEY_DOWN) { 80 if (event.keyCode == VKEY_DOWN) {
80 nextSuggestion(); 81 nextSuggestion();
(...skipping 29 matching lines...) Expand all
110 } 111 }
111 112
112 setUp(); 113 setUp();
113 114
114 </script> 115 </script>
115 </head> 116 </head>
116 <body> 117 <body>
117 <h1>Instant</h1> 118 <h1>Instant</h1>
118 </body> 119 </body>
119 </html> 120 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698