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

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

Issue 2413663002: Remove embeddedSearch.searchBox.focus (Closed)
Patch Set: . Created 4 years, 2 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 | « no previous file | 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 Focus();
17 native function GetMostVisitedItemData(); 16 native function GetMostVisitedItemData();
18 native function GetQuery(); 17 native function GetQuery();
19 native function GetSearchRequestParams(); 18 native function GetSearchRequestParams();
20 native function GetRightToLeft(); 19 native function GetRightToLeft();
21 native function GetSuggestionToPrefetch(); 20 native function GetSuggestionToPrefetch();
22 native function IsFocused(); 21 native function IsFocused();
23 native function IsKeyCaptureEnabled(); 22 native function IsKeyCaptureEnabled();
24 native function Paste(); 23 native function Paste();
25 native function StartCapturingKeyStrokes(); 24 native function StartCapturingKeyStrokes();
26 native function StopCapturingKeyStrokes(); 25 native function StopCapturingKeyStrokes();
27 26
28 // ======================================================================= 27 // =======================================================================
29 // Exported functions 28 // Exported functions
30 // ======================================================================= 29 // =======================================================================
31 this.__defineGetter__('isFocused', IsFocused); 30 this.__defineGetter__('isFocused', IsFocused);
32 this.__defineGetter__('isKeyCaptureEnabled', IsKeyCaptureEnabled); 31 this.__defineGetter__('isKeyCaptureEnabled', IsKeyCaptureEnabled);
33 this.__defineGetter__('rtl', GetRightToLeft); 32 this.__defineGetter__('rtl', GetRightToLeft);
34 this.__defineGetter__('suggestion', GetSuggestionToPrefetch); 33 this.__defineGetter__('suggestion', GetSuggestionToPrefetch);
35 this.__defineGetter__('value', GetQuery); 34 this.__defineGetter__('value', GetQuery);
36 Object.defineProperty(this, 'requestParams', 35 Object.defineProperty(this, 'requestParams',
37 { get: GetSearchRequestParams }); 36 { get: GetSearchRequestParams });
38 37
39 this.focus = function() {
40 Focus();
41 };
42
43 // This method is restricted to chrome-search://most-visited pages by 38 // This method is restricted to chrome-search://most-visited pages by
44 // checking the invoking context's origin in searchbox_extension.cc. 39 // checking the invoking context's origin in searchbox_extension.cc.
40 // TODO(treib): Why is this in searchBox rather than newTabPage?
45 this.getMostVisitedItemData = function(restrictedId) { 41 this.getMostVisitedItemData = function(restrictedId) {
46 var item = GetMostVisitedItemData(restrictedId); 42 var item = GetMostVisitedItemData(restrictedId);
47 if (item) { 43 if (item) {
48 var sizeInPx = Math.floor(48 * window.devicePixelRatio + 0.5); 44 var sizeInPx = Math.floor(48 * window.devicePixelRatio + 0.5);
49 // Populate large icon and fallback icon data, if they exist. We'll 45 // Populate large icon and fallback icon data, if they exist. We'll
50 // render everything here, once these become available by default. 46 // render everything here, once these become available by default.
51 if (item.largeIconUrl) { 47 if (item.largeIconUrl) {
52 item.largeIconUrl += 48 item.largeIconUrl +=
53 sizeInPx + "/" + item.renderViewId + "/" + item.rid; 49 sizeInPx + "/" + item.renderViewId + "/" + item.rid;
54 } 50 }
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 this.oninputcancel = null; 165 this.oninputcancel = null;
170 this.oninputstart = null; 166 this.oninputstart = null;
171 this.onmostvisitedchange = null; 167 this.onmostvisitedchange = null;
172 this.onthemechange = null; 168 this.onthemechange = null;
173 }; 169 };
174 170
175 // TODO(jered): Remove when google no longer expects this object. 171 // TODO(jered): Remove when google no longer expects this object.
176 chrome.searchBox = this.searchBox; 172 chrome.searchBox = this.searchBox;
177 }; 173 };
178 } 174 }
OLDNEW
« no previous file with comments | « no previous file | chrome/renderer/searchbox/searchbox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698