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 GetFont(); | 16 native function GetFont(); |
17 native function GetFontSize(); | 17 native function GetFontSize(); |
18 native function GetMostVisitedItemData(); | 18 native function GetMostVisitedItemData(); |
19 native function GetQuery(); | 19 native function GetQuery(); |
20 native function GetRightToLeft(); | 20 native function GetRightToLeft(); |
21 native function GetStartMargin(); | 21 native function GetStartMargin(); |
22 native function IsFocused(); | 22 native function IsFocused(); |
23 native function IsKeyCaptureEnabled(); | 23 native function IsKeyCaptureEnabled(); |
| 24 native function Paste(); |
24 native function SetVoiceSearchSupported(); | 25 native function SetVoiceSearchSupported(); |
25 native function StartCapturingKeyStrokes(); | 26 native function StartCapturingKeyStrokes(); |
26 native function StopCapturingKeyStrokes(); | 27 native function StopCapturingKeyStrokes(); |
27 | 28 |
28 // ======================================================================= | 29 // ======================================================================= |
29 // Exported functions | 30 // Exported functions |
30 // ======================================================================= | 31 // ======================================================================= |
31 this.__defineGetter__('font', GetFont); | 32 this.__defineGetter__('font', GetFont); |
32 this.__defineGetter__('fontSize', GetFontSize); | 33 this.__defineGetter__('fontSize', GetFontSize); |
33 this.__defineGetter__('isFocused', IsFocused); | 34 this.__defineGetter__('isFocused', IsFocused); |
34 this.__defineGetter__('isKeyCaptureEnabled', IsKeyCaptureEnabled); | 35 this.__defineGetter__('isKeyCaptureEnabled', IsKeyCaptureEnabled); |
35 this.__defineGetter__('rtl', GetRightToLeft); | 36 this.__defineGetter__('rtl', GetRightToLeft); |
36 this.__defineGetter__('startMargin', GetStartMargin); | 37 this.__defineGetter__('startMargin', GetStartMargin); |
37 this.__defineGetter__('value', GetQuery); | 38 this.__defineGetter__('value', GetQuery); |
38 | 39 |
39 // This method is restricted to chrome-search://most-visited pages by | 40 // This method is restricted to chrome-search://most-visited pages by |
40 // checking the invoking context's origin in searchbox_extension.cc. | 41 // checking the invoking context's origin in searchbox_extension.cc. |
41 this.getMostVisitedItemData = function(restrictedId) { | 42 this.getMostVisitedItemData = function(restrictedId) { |
42 return GetMostVisitedItemData(restrictedId); | 43 return GetMostVisitedItemData(restrictedId); |
43 }; | 44 }; |
44 | 45 |
| 46 this.paste = function(value) { |
| 47 Paste(value); |
| 48 }; |
| 49 |
45 this.setVoiceSearchSupported = function(supported) { | 50 this.setVoiceSearchSupported = function(supported) { |
46 SetVoiceSearchSupported(supported); | 51 SetVoiceSearchSupported(supported); |
47 }; | 52 }; |
48 | 53 |
49 this.startCapturingKeyStrokes = function() { | 54 this.startCapturingKeyStrokes = function() { |
50 StartCapturingKeyStrokes(); | 55 StartCapturingKeyStrokes(); |
51 }; | 56 }; |
52 | 57 |
53 this.stopCapturingKeyStrokes = function() { | 58 this.stopCapturingKeyStrokes = function() { |
54 StopCapturingKeyStrokes(); | 59 StopCapturingKeyStrokes(); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 this.oninputcancel = null; | 139 this.oninputcancel = null; |
135 this.oninputstart = null; | 140 this.oninputstart = null; |
136 this.onmostvisitedchange = null; | 141 this.onmostvisitedchange = null; |
137 this.onthemechange = null; | 142 this.onthemechange = null; |
138 }; | 143 }; |
139 | 144 |
140 // TODO(jered): Remove when google no longer expects this object. | 145 // TODO(jered): Remove when google no longer expects this object. |
141 chrome.searchBox = this.searchBox; | 146 chrome.searchBox = this.searchBox; |
142 }; | 147 }; |
143 } | 148 } |
OLD | NEW |