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

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

Issue 14562006: Handle Esc key press event in Local NTP. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: git cl upload Created 7 years, 7 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
« no previous file with comments | « chrome/renderer/searchbox/searchbox.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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", "http://www.google.com"]; 9 var suggestions = ["result 1", "result 2", "http://www.google.com"];
10 var suggestion; 10 var suggestion;
11 var suggestionType = 0; // INSTANT_SUGGESTION_SEARCH 11 var suggestionType = 0; // INSTANT_SUGGESTION_SEARCH
12 var behavior = 2; // INSTANT_COMPLETE_NEVER 12 var behavior = 2; // INSTANT_COMPLETE_NEVER
13 var onMostVisitedChangedCalls = 0; 13 var onMostVisitedChangedCalls = 0;
14 var mostVisitedItemsCount = 0; 14 var mostVisitedItemsCount = 0;
15 var firstMostVisitedItemId = 0; 15 var firstMostVisitedItemId = 0;
16 var onNativeSuggestionsCalls = 0; 16 var onNativeSuggestionsCalls = 0;
17 var onChangeCalls = 0; 17 var onChangeCalls = 0;
18 var submitCount = 0; 18 var submitCount = 0;
19 var onEscKeyPressedCalls = 0;
19 20
20 function getApiHandle() { 21 function getApiHandle() {
21 if (window.navigator && window.navigator.searchBox) 22 if (window.navigator && window.navigator.searchBox)
22 return window.navigator.searchBox; 23 return window.navigator.searchBox;
23 if (window.chrome && window.chrome.searchBox) 24 if (window.chrome && window.chrome.searchBox)
24 return window.chrome.searchBox; 25 return window.chrome.searchBox;
25 return null; 26 return null;
26 } 27 }
27 28
28 function getNewTabPageHandle() { 29 function getNewTabPageHandle() {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 } 72 }
72 } 73 }
73 } 74 }
74 75
75 function handleKeyPress(event) { 76 function handleKeyPress(event) {
76 var VKEY_ESCAPE = 0x1B; 77 var VKEY_ESCAPE = 0x1B;
77 var VKEY_UP = 0x26; 78 var VKEY_UP = 0x26;
78 var VKEY_DOWN = 0x28; 79 var VKEY_DOWN = 0x28;
79 80
80 if (event.keyCode == VKEY_ESCAPE) { 81 if (event.keyCode == VKEY_ESCAPE) {
82 onEscKeyPressedCalls++;
81 if (suggestionIndex != -1) { 83 if (suggestionIndex != -1) {
82 suggestionIndex = -1; 84 suggestionIndex = -1;
83 apiHandle.setAutocompleteText(suggestion, behavior); 85 apiHandle.setAutocompleteText(suggestion, behavior);
84 } 86 }
85 } else if (event.keyCode == VKEY_DOWN) { 87 } else if (event.keyCode == VKEY_DOWN) {
86 nextSuggestion(); 88 nextSuggestion();
87 } else if (event.keyCode == VKEY_UP) { 89 } else if (event.keyCode == VKEY_UP) {
88 previousSuggestion(); 90 previousSuggestion();
89 } 91 }
90 } 92 }
(...skipping 28 matching lines...) Expand all
119 } 121 }
120 122
121 setUp(); 123 setUp();
122 124
123 </script> 125 </script>
124 </head> 126 </head>
125 <body> 127 <body>
126 <h1>Instant</h1> 128 <h1>Instant</h1>
127 </body> 129 </body>
128 </html> 130 </html>
OLDNEW
« no previous file with comments | « chrome/renderer/searchbox/searchbox.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698