OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 var chrome; | 5 var chrome; |
6 if (!chrome) | 6 if (!chrome) |
7 chrome = {}; | 7 chrome = {}; |
8 if (!chrome.searchBox) { | 8 if (!chrome.searchBox) { |
9 chrome.searchBox = new function() { | 9 chrome.searchBox = new function() { |
10 // ========================================================================= | 10 // ========================================================================= |
(...skipping 19 matching lines...) Expand all Loading... |
30 native function GetHeight(); | 30 native function GetHeight(); |
31 native function GetAutocompleteResults(); | 31 native function GetAutocompleteResults(); |
32 native function GetContext(); | 32 native function GetContext(); |
33 native function NavigateContentWindow(); | 33 native function NavigateContentWindow(); |
34 native function SetSuggestions(); | 34 native function SetSuggestions(); |
35 native function SetQuerySuggestion(); | 35 native function SetQuerySuggestion(); |
36 native function SetQuerySuggestionFromAutocompleteResult(); | 36 native function SetQuerySuggestionFromAutocompleteResult(); |
37 native function SetQuery(); | 37 native function SetQuery(); |
38 native function SetQueryFromAutocompleteResult(); | 38 native function SetQueryFromAutocompleteResult(); |
39 native function Show(); | 39 native function Show(); |
| 40 native function WebSearchBoxFocusChange(); |
40 | 41 |
41 // Returns the |restrictedText| wrapped in a ShadowDOM. | 42 // Returns the |restrictedText| wrapped in a ShadowDOM. |
42 function SafeWrap(restrictedText) { | 43 function SafeWrap(restrictedText) { |
43 var node = document.createElement('div'); | 44 var node = document.createElement('div'); |
44 var nodeShadow = new WebKitShadowRoot(node); | 45 var nodeShadow = new WebKitShadowRoot(node); |
45 nodeShadow.applyAuthorStyles = true; | 46 nodeShadow.applyAuthorStyles = true; |
46 nodeShadow.innerHTML = | 47 nodeShadow.innerHTML = |
47 '<div style="width:700px!important;' + | 48 '<div style="width:700px!important;' + |
48 ' height:22px!important;' + | 49 ' height:22px!important;' + |
49 ' font-family:\'Chrome Droid Sans\',\'Arial\'!important;' + | 50 ' font-family:\'Chrome Droid Sans\',\'Arial\'!important;' + |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 }; | 193 }; |
193 this.show = function(reason, height) { | 194 this.show = function(reason, height) { |
194 Show(reason, height); | 195 Show(reason, height); |
195 }; | 196 }; |
196 this.markDuplicateSuggestions = function(clientSuggestions) { | 197 this.markDuplicateSuggestions = function(clientSuggestions) { |
197 return DedupeClientSuggestions(clientSuggestions); | 198 return DedupeClientSuggestions(clientSuggestions); |
198 }; | 199 }; |
199 this.navigateContentWindow = function(destination) { | 200 this.navigateContentWindow = function(destination) { |
200 return NavigateContentWindow(destination); | 201 return NavigateContentWindow(destination); |
201 }; | 202 }; |
| 203 this.webSearchBoxGotFocus = function() { |
| 204 WebSearchBoxFocusChange(true); |
| 205 }; |
| 206 this.webSearchBoxLostFocus = function() { |
| 207 WebSearchBoxFocusChange(false); |
| 208 }; |
202 this.onchange = null; | 209 this.onchange = null; |
203 this.onsubmit = null; | 210 this.onsubmit = null; |
204 this.oncancel = null; | 211 this.oncancel = null; |
205 this.onresize = null; | 212 this.onresize = null; |
206 this.onautocompleteresults = null; | 213 this.onautocompleteresults = null; |
207 this.onkeypress = null; | 214 this.onkeypress = null; |
208 this.oncontextchange = null; | 215 this.oncontextchange = null; |
209 }; | 216 }; |
210 } | 217 } |
OLD | NEW |