Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(284)

Side by Side Diff: chrome/renderer/resources/extensions/searchbox_api.js

Issue 20501002: Adds paste function to searchbox api and handles paste event on fakebox (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nits Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/common/render_messages.h ('k') | chrome/renderer/searchbox/searchbox.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 }
OLDNEW
« no previous file with comments | « chrome/common/render_messages.h ('k') | chrome/renderer/searchbox/searchbox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698