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

Side by Side Diff: chrome/browser/resources/local_omnibox_popup/local_omnibox_popup.js

Issue 11833043: Instant Extended: Fallback to local preview if the remote instant page is not ready on user input. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@refactor
Patch Set: Addressing sreeram's comments. 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
« no previous file with comments | « chrome/browser/instant/instant_test_utils.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 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // ============================================================================= 5 // =============================================================================
6 // Util functions 6 // Util functions
7 // ============================================================================= 7 // =============================================================================
8 8
9 /** 9 /**
10 * The maximum number of suggestions to show. 10 * The maximum number of suggestions to show.
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 return window.navigator.searchBox; 138 return window.navigator.searchBox;
139 if (window.chrome && window.chrome.searchBox) 139 if (window.chrome && window.chrome.searchBox)
140 return window.chrome.searchBox; 140 return window.chrome.searchBox;
141 return null; 141 return null;
142 } 142 }
143 143
144 /** 144 /**
145 * chrome.searchBox.onnativesuggestions implementation. 145 * chrome.searchBox.onnativesuggestions implementation.
146 */ 146 */
147 function handleNativeSuggestions() { 147 function handleNativeSuggestions() {
148 // This can't be done in setUpApi(), because apiHandle.font/fontSize
149 // isn't available yet.
150 var suggestionStyleNode = $('suggestionStyle');
151 if (!suggestionStyleNode)
152 appendSuggestionStyles();
153
154 var apiHandle = getApiObjectHandle(); 148 var apiHandle = getApiObjectHandle();
155 149
156 // Used to workaround repeated undesired asynchronous onnativesuggestions 150 // Used to workaround repeated undesired asynchronous onnativesuggestions
157 // events and the fact that when a suggestion is clicked, the omnibox unfocus 151 // events and the fact that when a suggestion is clicked, the omnibox unfocus
158 // can cause onnativesuggestions to fire, preventing the suggestion onclick 152 // can cause onnativesuggestions to fire, preventing the suggestion onclick
159 // from registering. 153 // from registering.
160 if (lastInputValue == apiHandle.value && $('suggestionsBox')) { 154 if (lastInputValue == apiHandle.value && $('suggestionsBox')) {
161 return; 155 return;
162 } 156 }
163 lastInputValue = apiHandle.value; 157 lastInputValue = apiHandle.value;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 } 221 }
228 222
229 /** 223 /**
230 * Sets up the searchBox API. 224 * Sets up the searchBox API.
231 */ 225 */
232 function setUpApi() { 226 function setUpApi() {
233 var apiHandle = getApiObjectHandle(); 227 var apiHandle = getApiObjectHandle();
234 apiHandle.onnativesuggestions = handleNativeSuggestions; 228 apiHandle.onnativesuggestions = handleNativeSuggestions;
235 apiHandle.onkeypress = handleKeyPress; 229 apiHandle.onkeypress = handleKeyPress;
236 apiHandle.onsubmit = onSubmit; 230 apiHandle.onsubmit = onSubmit;
231 appendSuggestionStyles();
232
233 if (apiHandle.nativeSuggestions.length)
234 handleNativeSuggestions();
237 } 235 }
238 236
239 document.addEventListener('DOMContentLoaded', setUpApi); 237 document.addEventListener('DOMContentLoaded', setUpApi);
OLDNEW
« no previous file with comments | « chrome/browser/instant/instant_test_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698