Chromium Code Reviews| 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 GetDisplayInstantResults(); | 17 native function GetDisplayInstantResults(); |
| 17 native function GetFont(); | 18 native function GetFont(); |
| 18 native function GetFontSize(); | 19 native function GetFontSize(); |
| 19 native function GetMostVisitedItemData(); | 20 native function GetMostVisitedItemData(); |
| 20 native function GetQuery(); | 21 native function GetQuery(); |
| 21 native function GetRightToLeft(); | 22 native function GetRightToLeft(); |
| 22 native function GetStartMargin(); | 23 native function GetStartMargin(); |
| 23 native function GetSuggestionToPrefetch(); | 24 native function GetSuggestionToPrefetch(); |
| 24 native function IsFocused(); | 25 native function IsFocused(); |
| 25 native function IsKeyCaptureEnabled(); | 26 native function IsKeyCaptureEnabled(); |
| 26 native function Paste(); | 27 native function Paste(); |
| 27 native function SetVoiceSearchSupported(); | 28 native function SetVoiceSearchSupported(); |
| 28 native function StartCapturingKeyStrokes(); | 29 native function StartCapturingKeyStrokes(); |
| 29 native function StopCapturingKeyStrokes(); | 30 native function StopCapturingKeyStrokes(); |
| 30 | 31 |
| 31 // ======================================================================= | 32 // ======================================================================= |
| 32 // Exported functions | 33 // Exported functions |
| 33 // ======================================================================= | 34 // ======================================================================= |
| 34 this.__defineGetter__('displayInstantResults', GetDisplayInstantResults); | 35 this.__defineGetter__('displayInstantResults', GetDisplayInstantResults); |
| 35 this.__defineGetter__('font', GetFont); | 36 this.__defineGetter__('font', GetFont); |
| 36 this.__defineGetter__('fontSize', GetFontSize); | 37 this.__defineGetter__('fontSize', GetFontSize); |
| 37 this.__defineGetter__('isFocused', IsFocused); | 38 this.__defineGetter__('isFocused', IsFocused); |
| 38 this.__defineGetter__('isKeyCaptureEnabled', IsKeyCaptureEnabled); | 39 this.__defineGetter__('isKeyCaptureEnabled', IsKeyCaptureEnabled); |
| 39 this.__defineGetter__('rtl', GetRightToLeft); | 40 this.__defineGetter__('rtl', GetRightToLeft); |
| 40 this.__defineGetter__('startMargin', GetStartMargin); | 41 this.__defineGetter__('startMargin', GetStartMargin); |
| 41 this.__defineGetter__('suggestion', GetSuggestionToPrefetch); | 42 this.__defineGetter__('suggestion', GetSuggestionToPrefetch); |
| 42 this.__defineGetter__('value', GetQuery); | 43 this.__defineGetter__('value', GetQuery); |
| 43 | 44 |
| 45 this.focus = function() { | |
| 46 Focus(); | |
| 47 } | |
|
jfweitz
2013/08/29 00:47:52
nit: missing ';'
samarth
2013/08/29 00:51:07
Done.
| |
| 48 | |
| 44 // This method is restricted to chrome-search://most-visited pages by | 49 // This method is restricted to chrome-search://most-visited pages by |
| 45 // checking the invoking context's origin in searchbox_extension.cc. | 50 // checking the invoking context's origin in searchbox_extension.cc. |
| 46 this.getMostVisitedItemData = function(restrictedId) { | 51 this.getMostVisitedItemData = function(restrictedId) { |
| 47 return GetMostVisitedItemData(restrictedId); | 52 return GetMostVisitedItemData(restrictedId); |
| 48 }; | 53 }; |
| 49 | 54 |
| 50 this.paste = function(value) { | 55 this.paste = function(value) { |
| 51 Paste(value); | 56 Paste(value); |
| 52 }; | 57 }; |
| 53 | 58 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 143 this.oninputcancel = null; | 148 this.oninputcancel = null; |
| 144 this.oninputstart = null; | 149 this.oninputstart = null; |
| 145 this.onmostvisitedchange = null; | 150 this.onmostvisitedchange = null; |
| 146 this.onthemechange = null; | 151 this.onthemechange = null; |
| 147 }; | 152 }; |
| 148 | 153 |
| 149 // TODO(jered): Remove when google no longer expects this object. | 154 // TODO(jered): Remove when google no longer expects this object. |
| 150 chrome.searchBox = this.searchBox; | 155 chrome.searchBox = this.searchBox; |
| 151 }; | 156 }; |
| 152 } | 157 } |
| OLD | NEW |