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

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

Issue 11889003: Fixing ESC in instant-extended. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ensure the IC.last_match_was_search_ is correctly restored. Created 7 years, 10 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 onnativesuggestioncalls = 0; 6 var onnativesuggestioncalls = 0;
7 var onsubmitcalls = 0; 7 var onsubmitcalls = 0;
8 var savedUserText = null; 8 var savedUserText = null;
9 var suggestionIndex = -1; 9 var suggestionIndex = -1;
10 var suggestions = ["result 1", "result 2", "result 3"]; 10 var suggestions = ["result 1", "result 2", "result 3"];
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 apiHandle.setValue(savedUserText); 52 apiHandle.setValue(savedUserText);
53 } else { 53 } else {
54 apiHandle.setValue(suggestions[suggestionIndex]); 54 apiHandle.setValue(suggestions[suggestionIndex]);
55 } 55 }
56 } 56 }
57 } 57 }
58 58
59 function handleKeyPress(event) { 59 function handleKeyPress(event) {
60 var VKEY_UP = 0x26; 60 var VKEY_UP = 0x26;
61 var VKEY_DOWN = 0x28; 61 var VKEY_DOWN = 0x28;
62 var VKEY_ESCAPE = 0x1B;
62 63
63 if (event.keyCode == VKEY_DOWN) { 64 if (event.keyCode == VKEY_DOWN) {
64 nextSuggestion(); 65 nextSuggestion();
65 } else if (event.keyCode == VKEY_UP) { 66 } else if (event.keyCode == VKEY_UP) {
66 previousSuggestion(); 67 previousSuggestion();
68 } else if (event.keyCode == VKEY_ESCAPE) {
69 suggestionIndex = -1;
67 } 70 }
68 } 71 }
69 72
70 function setUp() { 73 function setUp() {
71 apiHandle = getApiHandle(); 74 apiHandle = getApiHandle();
72 apiHandle.onnativesuggestions = handleNativeSuggestions; 75 apiHandle.onnativesuggestions = handleNativeSuggestions;
73 apiHandle.onsubmit = handleSubmit; 76 apiHandle.onsubmit = handleSubmit;
74 apiHandle.onchange = handleOnChange; 77 apiHandle.onchange = handleOnChange;
75 apiHandle.onkeypress = handleKeyPress; 78 apiHandle.onkeypress = handleKeyPress;
76 if (apiHandle.value) { 79 if (apiHandle.value) {
77 handleNativeSuggestions(); 80 handleNativeSuggestions();
78 handleOnChange(); 81 handleOnChange();
79 } 82 }
80 } 83 }
81 84
82 setUp(); 85 setUp();
83 86
84 </script> 87 </script>
85 </head> 88 </head>
86 <body> 89 <body>
87 <h1>Instant</h1> 90 <h1>Instant</h1>
88 </body> 91 </body>
89 </html> 92 </html>
OLDNEW
« chrome/renderer/searchbox/searchbox.cc ('K') | « chrome/renderer/searchbox/searchbox_extension.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698