| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 native function SetQuery(); | 98 native function SetQuery(); |
| 99 native function SetQueryFromAutocompleteResult(); | 99 native function SetQueryFromAutocompleteResult(); |
| 100 native function SetSuggestion(); | 100 native function SetSuggestion(); |
| 101 native function SetSuggestionFromAutocompleteResult(); | 101 native function SetSuggestionFromAutocompleteResult(); |
| 102 native function SetSuggestions(); | 102 native function SetSuggestions(); |
| 103 native function ShowOverlay(); | 103 native function ShowOverlay(); |
| 104 native function FocusOmnibox(); | 104 native function FocusOmnibox(); |
| 105 native function StartCapturingKeyStrokes(); | 105 native function StartCapturingKeyStrokes(); |
| 106 native function StopCapturingKeyStrokes(); | 106 native function StopCapturingKeyStrokes(); |
| 107 native function NavigateSearchBox(); | 107 native function NavigateSearchBox(); |
| 108 native function ShowBars(); |
| 109 native function HideBars(); |
| 108 | 110 |
| 109 function SafeWrapSuggestion(restrictedText) { | 111 function SafeWrapSuggestion(restrictedText) { |
| 110 return SafeWrap(restrictedText, window.innerWidth - 155, 22); | 112 return SafeWrap(restrictedText, window.innerWidth - 155, 22); |
| 111 } | 113 } |
| 112 | 114 |
| 113 // Wraps the AutocompleteResult query and URL into ShadowDOM nodes so that | 115 // Wraps the AutocompleteResult query and URL into ShadowDOM nodes so that |
| 114 // the JS cannot access them and deletes the raw values. | 116 // the JS cannot access them and deletes the raw values. |
| 115 function GetAutocompleteResultsWrapper() { | 117 function GetAutocompleteResultsWrapper() { |
| 116 var autocompleteResults = DedupeAutocompleteResults( | 118 var autocompleteResults = DedupeAutocompleteResults( |
| 117 GetAutocompleteResults()); | 119 GetAutocompleteResults()); |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 }; | 265 }; |
| 264 this.startCapturingKeyStrokes = function() { | 266 this.startCapturingKeyStrokes = function() { |
| 265 StartCapturingKeyStrokes(); | 267 StartCapturingKeyStrokes(); |
| 266 }; | 268 }; |
| 267 this.stopCapturingKeyStrokes = function() { | 269 this.stopCapturingKeyStrokes = function() { |
| 268 StopCapturingKeyStrokes(); | 270 StopCapturingKeyStrokes(); |
| 269 }; | 271 }; |
| 270 this.navigateContentWindow = function(destination, disposition) { | 272 this.navigateContentWindow = function(destination, disposition) { |
| 271 NavigateSearchBox(destination, disposition); | 273 NavigateSearchBox(destination, disposition); |
| 272 } | 274 } |
| 275 this.showBars = function() { |
| 276 ShowBars(); |
| 277 }; |
| 278 this.hideBars = function() { |
| 279 HideBars(); |
| 280 }; |
| 273 this.onchange = null; | 281 this.onchange = null; |
| 274 this.onsubmit = null; | 282 this.onsubmit = null; |
| 275 this.oncancel = null; | 283 this.oncancel = null; |
| 276 this.onresize = null; | 284 this.onresize = null; |
| 277 this.onkeypress = null; | 285 this.onkeypress = null; |
| 278 this.onkeycapturechange = null; | 286 this.onkeycapturechange = null; |
| 279 this.onmarginchange = null; | 287 this.onmarginchange = null; |
| 280 this.onnativesuggestions = null; | 288 this.onnativesuggestions = null; |
| 289 this.onbarshidden = null; |
| 281 | 290 |
| 282 // DEPRECATED. These methods are from the legacy searchbox API. | 291 // DEPRECATED. These methods are from the legacy searchbox API. |
| 283 // TODO(jered): Delete these. | 292 // TODO(jered): Delete these. |
| 284 native function GetX(); | 293 native function GetX(); |
| 285 native function GetY(); | 294 native function GetY(); |
| 286 native function GetWidth(); | 295 native function GetWidth(); |
| 287 native function GetHeight(); | 296 native function GetHeight(); |
| 288 this.__defineGetter__('x', GetX); | 297 this.__defineGetter__('x', GetX); |
| 289 this.__defineGetter__('y', GetY); | 298 this.__defineGetter__('y', GetY); |
| 290 this.__defineGetter__('width', GetWidth); | 299 this.__defineGetter__('width', GetWidth); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 | 351 |
| 343 this.onmostvisitedchange = null; | 352 this.onmostvisitedchange = null; |
| 344 this.onthemechange = null; | 353 this.onthemechange = null; |
| 345 }; | 354 }; |
| 346 | 355 |
| 347 // Export legacy searchbox API. | 356 // Export legacy searchbox API. |
| 348 // TODO: Remove this when Instant Extended is fully launched. | 357 // TODO: Remove this when Instant Extended is fully launched. |
| 349 chrome.searchBox = this.searchBox; | 358 chrome.searchBox = this.searchBox; |
| 350 }; | 359 }; |
| 351 } | 360 } |
| OLD | NEW |