| 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() { |
| 11 this.searchBox = new function() { | 11 this.searchBox = new function() { |
| 12 | 12 |
| 13 // ======================================================================= | 13 // ======================================================================= |
| 14 // Private functions | 14 // Private functions |
| 15 // ======================================================================= | 15 // ======================================================================= |
| 16 native function Focus(); | 16 native function Focus(); |
| 17 native function GetDisplayInstantResults(); | 17 native function GetDisplayInstantResults(); |
| 18 native function GetMostVisitedItemData(); | 18 native function GetMostVisitedItemData(); |
| 19 native function GetQuery(); | 19 native function GetQuery(); |
| 20 native function GetSearchRequestParams(); |
| 20 native function GetRightToLeft(); | 21 native function GetRightToLeft(); |
| 21 native function GetStartMargin(); | 22 native function GetStartMargin(); |
| 22 native function GetSuggestionToPrefetch(); | 23 native function GetSuggestionToPrefetch(); |
| 23 native function IsFocused(); | 24 native function IsFocused(); |
| 24 native function IsKeyCaptureEnabled(); | 25 native function IsKeyCaptureEnabled(); |
| 25 native function Paste(); | 26 native function Paste(); |
| 26 native function SetVoiceSearchSupported(); | 27 native function SetVoiceSearchSupported(); |
| 27 native function StartCapturingKeyStrokes(); | 28 native function StartCapturingKeyStrokes(); |
| 28 native function StopCapturingKeyStrokes(); | 29 native function StopCapturingKeyStrokes(); |
| 29 | 30 |
| 30 // ======================================================================= | 31 // ======================================================================= |
| 31 // Exported functions | 32 // Exported functions |
| 32 // ======================================================================= | 33 // ======================================================================= |
| 33 this.__defineGetter__('displayInstantResults', GetDisplayInstantResults); | 34 this.__defineGetter__('displayInstantResults', GetDisplayInstantResults); |
| 34 this.__defineGetter__('isFocused', IsFocused); | 35 this.__defineGetter__('isFocused', IsFocused); |
| 35 this.__defineGetter__('isKeyCaptureEnabled', IsKeyCaptureEnabled); | 36 this.__defineGetter__('isKeyCaptureEnabled', IsKeyCaptureEnabled); |
| 36 this.__defineGetter__('rtl', GetRightToLeft); | 37 this.__defineGetter__('rtl', GetRightToLeft); |
| 37 this.__defineGetter__('startMargin', GetStartMargin); | 38 this.__defineGetter__('startMargin', GetStartMargin); |
| 38 this.__defineGetter__('suggestion', GetSuggestionToPrefetch); | 39 this.__defineGetter__('suggestion', GetSuggestionToPrefetch); |
| 39 this.__defineGetter__('value', GetQuery); | 40 this.__defineGetter__('value', GetQuery); |
| 41 Object.defineProperty(this, 'requestParams', |
| 42 { get: GetSearchRequestParams }); |
| 40 | 43 |
| 41 this.focus = function() { | 44 this.focus = function() { |
| 42 Focus(); | 45 Focus(); |
| 43 }; | 46 }; |
| 44 | 47 |
| 45 // This method is restricted to chrome-search://most-visited pages by | 48 // This method is restricted to chrome-search://most-visited pages by |
| 46 // checking the invoking context's origin in searchbox_extension.cc. | 49 // checking the invoking context's origin in searchbox_extension.cc. |
| 47 this.getMostVisitedItemData = function(restrictedId) { | 50 this.getMostVisitedItemData = function(restrictedId) { |
| 48 return GetMostVisitedItemData(restrictedId); | 51 return GetMostVisitedItemData(restrictedId); |
| 49 }; | 52 }; |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 this.oninputcancel = null; | 180 this.oninputcancel = null; |
| 178 this.oninputstart = null; | 181 this.oninputstart = null; |
| 179 this.onmostvisitedchange = null; | 182 this.onmostvisitedchange = null; |
| 180 this.onthemechange = null; | 183 this.onthemechange = null; |
| 181 }; | 184 }; |
| 182 | 185 |
| 183 // TODO(jered): Remove when google no longer expects this object. | 186 // TODO(jered): Remove when google no longer expects this object. |
| 184 chrome.searchBox = this.searchBox; | 187 chrome.searchBox = this.searchBox; |
| 185 }; | 188 }; |
| 186 } | 189 } |
| OLD | NEW |