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

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

Issue 14646034: Add onfocuschange to the Extended Search API, with associated isFocused attribute. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix indent issues. 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
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 var onEscKeyPressedCalls = 0;
20 var onFocusChangedCalls = 0;
21 var isFocused = false;
20 22
21 function getApiHandle() { 23 function getApiHandle() {
22 if (window.navigator && window.navigator.searchBox) 24 if (window.navigator && window.navigator.searchBox)
23 return window.navigator.searchBox; 25 return window.navigator.searchBox;
24 if (window.chrome && window.chrome.searchBox) 26 if (window.chrome && window.chrome.searchBox)
25 return window.chrome.searchBox; 27 return window.chrome.searchBox;
26 return null; 28 return null;
27 } 29 }
28 30
29 function getNewTabPageHandle() { 31 function getNewTabPageHandle() {
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 95
94 function handleMostVisitedChange() { 96 function handleMostVisitedChange() {
95 onMostVisitedChangedCalls++; 97 onMostVisitedChangedCalls++;
96 var items = newTabPageHandle.mostVisited; 98 var items = newTabPageHandle.mostVisited;
97 if (items) { 99 if (items) {
98 mostVisitedItemsCount = items.length; 100 mostVisitedItemsCount = items.length;
99 firstMostVisitedItemId = items[0] ? items[0].rid : 0; 101 firstMostVisitedItemId = items[0] ? items[0].rid : 0;
100 } 102 }
101 } 103 }
102 104
105 function handleFocusChange() {
samarth 2013/05/15 19:05:53 A test for this would be good. I assume you added
Donn Denman 2013/05/20 23:48:14 OK, coming soon!
106 onFocusChangedCalls++;
107 isFocused = apiHandle.isFocused;
108 }
109
103 function setUp() { 110 function setUp() {
104 apiHandle = getApiHandle(); 111 apiHandle = getApiHandle();
105 if (!apiHandle) 112 if (!apiHandle)
106 return; 113 return;
107 114
108 newTabPageHandle = getNewTabPageHandle(); 115 newTabPageHandle = getNewTabPageHandle();
109 apiHandle.onnativesuggestions = handleNativeSuggestions; 116 apiHandle.onnativesuggestions = handleNativeSuggestions;
110 apiHandle.onsubmit = handleSubmit; 117 apiHandle.onsubmit = handleSubmit;
111 apiHandle.onchange = handleOnChange; 118 apiHandle.onchange = handleOnChange;
112 apiHandle.onkeypress = handleKeyPress; 119 apiHandle.onkeypress = handleKeyPress;
120 apiHandle.onfocuschange = handleFocusChange;
113 newTabPageHandle.onmostvisitedchange = handleMostVisitedChange; 121 newTabPageHandle.onmostvisitedchange = handleMostVisitedChange;
114 if (apiHandle.value) { 122 if (apiHandle.value) {
115 handleNativeSuggestions(); 123 handleNativeSuggestions();
116 handleOnChange(); 124 handleOnChange();
117 } 125 }
118 if (newTabPageHandle.mostVisited && newTabPageHandle.mostVisited.length) { 126 if (newTabPageHandle.mostVisited && newTabPageHandle.mostVisited.length) {
119 handleMostVisitedChange(); 127 handleMostVisitedChange();
120 } 128 }
121 } 129 }
122 130
123 setUp(); 131 setUp();
124 132
125 </script> 133 </script>
126 </head> 134 </head>
127 <body> 135 <body>
128 <h1>Instant</h1> 136 <h1>Instant</h1>
129 </body> 137 </body>
130 </html> 138 </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