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

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: TODO Created 7 years, 8 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 24 matching lines...) Expand all
46 function handleOnChange() { 47 function handleOnChange() {
47 onChangeCalls++; 48 onChangeCalls++;
48 savedUserText = apiHandle.value; 49 savedUserText = apiHandle.value;
49 suggestionIndex = -1; 50 suggestionIndex = -1;
50 apiHandle.setAutocompleteText(suggestion, behavior); 51 apiHandle.setAutocompleteText(suggestion, behavior);
51 } 52 }
52 53
53 function nextSuggestion() { 54 function nextSuggestion() {
54 if (suggestionIndex < suggestions.length - 1) { 55 if (suggestionIndex < suggestions.length - 1) {
55 suggestionIndex++; 56 suggestionIndex++;
56 apiHandle.setValue(suggestions[suggestionIndex]); 57 apiHandle.setValue(suggestions[suggestionIndex], suggestionType);
57 } 58 }
58 } 59 }
59 60
60 function previousSuggestion() { 61 function previousSuggestion() {
61 if (suggestionIndex != -1) { 62 if (suggestionIndex != -1) {
62 suggestionIndex--; 63 suggestionIndex--;
63 if (suggestionIndex == -1) { 64 if (suggestionIndex == -1) {
64 apiHandle.setValue(savedUserText); 65 apiHandle.setValue(savedUserText, suggestionType);
65 } else { 66 } else {
66 apiHandle.setValue(suggestions[suggestionIndex]); 67 apiHandle.setValue(suggestions[suggestionIndex], suggestionType);
67 } 68 }
68 } 69 }
69 } 70 }
70 71
71 function handleKeyPress(event) { 72 function handleKeyPress(event) {
72 var VKEY_ESCAPE = 0x1B; 73 var VKEY_ESCAPE = 0x1B;
73 var VKEY_UP = 0x26; 74 var VKEY_UP = 0x26;
74 var VKEY_DOWN = 0x28; 75 var VKEY_DOWN = 0x28;
75 76
76 if (event.keyCode == VKEY_ESCAPE) { 77 if (event.keyCode == VKEY_ESCAPE) {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 } 113 }
113 114
114 setUp(); 115 setUp();
115 116
116 </script> 117 </script>
117 </head> 118 </head>
118 <body> 119 <body>
119 <h1>Instant</h1> 120 <h1>Instant</h1>
120 </body> 121 </body>
121 </html> 122 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698