| OLD | NEW |
| 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 var chrome; | 5 var chrome; |
| 6 if (!chrome) | 6 if (!chrome) |
| 7 chrome = {}; | 7 chrome = {}; |
| 8 | 8 |
| 9 if (!chrome.embeddedSearch) { | 9 if (!chrome.embeddedSearch) { |
| 10 chrome.embeddedSearch = new function() { | 10 chrome.embeddedSearch = new function() { |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 native function IsKeyCaptureEnabled(); | 95 native function IsKeyCaptureEnabled(); |
| 96 native function SetSuggestions(); | 96 native function SetSuggestions(); |
| 97 native function SetQuerySuggestion(); | 97 native function SetQuerySuggestion(); |
| 98 native function SetQuerySuggestionFromAutocompleteResult(); | 98 native function SetQuerySuggestionFromAutocompleteResult(); |
| 99 native function SetQuery(); | 99 native function SetQuery(); |
| 100 native function SetQueryFromAutocompleteResult(); | 100 native function SetQueryFromAutocompleteResult(); |
| 101 native function ShowOverlay(); | 101 native function ShowOverlay(); |
| 102 native function FocusOmnibox(); | 102 native function FocusOmnibox(); |
| 103 native function StartCapturingKeyStrokes(); | 103 native function StartCapturingKeyStrokes(); |
| 104 native function StopCapturingKeyStrokes(); | 104 native function StopCapturingKeyStrokes(); |
| 105 native function ShowBars(); |
| 106 native function HideBars(); |
| 105 | 107 |
| 106 function SafeWrapSuggestion(restrictedText) { | 108 function SafeWrapSuggestion(restrictedText) { |
| 107 return SafeWrap(restrictedText, window.innerWidth - 155, 22); | 109 return SafeWrap(restrictedText, window.innerWidth - 155, 22); |
| 108 } | 110 } |
| 109 | 111 |
| 110 // Wraps the AutocompleteResult query and URL into ShadowDOM nodes so that | 112 // Wraps the AutocompleteResult query and URL into ShadowDOM nodes so that |
| 111 // the JS cannot access them and deletes the raw values. | 113 // the JS cannot access them and deletes the raw values. |
| 112 function GetAutocompleteResultsWrapper() { | 114 function GetAutocompleteResultsWrapper() { |
| 113 var autocompleteResults = DedupeAutocompleteResults( | 115 var autocompleteResults = DedupeAutocompleteResults( |
| 114 GetAutocompleteResults()); | 116 GetAutocompleteResults()); |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 }; | 261 }; |
| 260 this.focus = function() { | 262 this.focus = function() { |
| 261 FocusOmnibox(); | 263 FocusOmnibox(); |
| 262 }; | 264 }; |
| 263 this.startCapturingKeyStrokes = function() { | 265 this.startCapturingKeyStrokes = function() { |
| 264 StartCapturingKeyStrokes(); | 266 StartCapturingKeyStrokes(); |
| 265 }; | 267 }; |
| 266 this.stopCapturingKeyStrokes = function() { | 268 this.stopCapturingKeyStrokes = function() { |
| 267 StopCapturingKeyStrokes(); | 269 StopCapturingKeyStrokes(); |
| 268 }; | 270 }; |
| 271 this.showBars = function() { |
| 272 ShowBars(); |
| 273 }; |
| 274 this.hideBars = function() { |
| 275 HideBars(); |
| 276 }; |
| 269 this.onchange = null; | 277 this.onchange = null; |
| 270 this.onsubmit = null; | 278 this.onsubmit = null; |
| 271 this.oncancel = null; | 279 this.oncancel = null; |
| 272 this.onresize = null; | 280 this.onresize = null; |
| 273 this.onkeypress = null; | 281 this.onkeypress = null; |
| 274 this.onkeycapturechange = null; | 282 this.onkeycapturechange = null; |
| 275 this.oncontextchange = null; | 283 this.oncontextchange = null; |
| 276 this.onmarginchange = null; | 284 this.onmarginchange = null; |
| 277 this.onnativesuggestions = null; | 285 this.onnativesuggestions = null; |
| 286 this.onbarshidden = null; |
| 278 | 287 |
| 279 // DEPRECATED. These methods are from the legacy searchbox API. | 288 // DEPRECATED. These methods are from the legacy searchbox API. |
| 280 // TODO(jered): Delete these. | 289 // TODO(jered): Delete these. |
| 281 native function GetX(); | 290 native function GetX(); |
| 282 native function GetY(); | 291 native function GetY(); |
| 283 native function GetWidth(); | 292 native function GetWidth(); |
| 284 native function GetHeight(); | 293 native function GetHeight(); |
| 285 this.__defineGetter__('x', GetX); | 294 this.__defineGetter__('x', GetX); |
| 286 this.__defineGetter__('y', GetY); | 295 this.__defineGetter__('y', GetY); |
| 287 this.__defineGetter__('width', GetWidth); | 296 this.__defineGetter__('width', GetWidth); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 | 344 |
| 336 this.onmostvisitedchange = null; | 345 this.onmostvisitedchange = null; |
| 337 this.onthemechange = null; | 346 this.onthemechange = null; |
| 338 }; | 347 }; |
| 339 | 348 |
| 340 // Export legacy searchbox API. | 349 // Export legacy searchbox API. |
| 341 // TODO: Remove this when Instant Extended is fully launched. | 350 // TODO: Remove this when Instant Extended is fully launched. |
| 342 chrome.searchBox = this.searchBox; | 351 chrome.searchBox = this.searchBox; |
| 343 }; | 352 }; |
| 344 } | 353 } |
| OLD | NEW |