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

Unified Diff: chrome/renderer/resources/extensions/searchbox_api.js

Issue 2531443003: Searchbox API cleanup: Move getMostVisitedItemData to newTabPage (Closed)
Patch Set: Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/local_ntp/most_visited_util.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/resources/extensions/searchbox_api.js
diff --git a/chrome/renderer/resources/extensions/searchbox_api.js b/chrome/renderer/resources/extensions/searchbox_api.js
index cc7bfa5ab3a07e02aa76d3c0383426f4e7a301ef..189e2b301801dc34a3a32814b649c97182e61c11 100644
--- a/chrome/renderer/resources/extensions/searchbox_api.js
+++ b/chrome/renderer/resources/extensions/searchbox_api.js
@@ -13,7 +13,6 @@ if (!chrome.embeddedSearch) {
// =======================================================================
// Private functions
// =======================================================================
- native function GetMostVisitedItemData();
native function GetQuery();
native function GetSearchRequestParams();
native function GetRightToLeft();
@@ -35,27 +34,6 @@ if (!chrome.embeddedSearch) {
Object.defineProperty(this, 'requestParams',
{ get: GetSearchRequestParams });
- // This method is restricted to chrome-search://most-visited pages by
- // checking the invoking context's origin in searchbox_extension.cc.
- // TODO(treib): Why is this in searchBox rather than newTabPage?
- this.getMostVisitedItemData = function(restrictedId) {
- var item = GetMostVisitedItemData(restrictedId);
- if (item) {
- var sizeInPx = Math.floor(48 * window.devicePixelRatio + 0.5);
- // Populate large icon and fallback icon data, if they exist. We'll
- // render everything here, once these become available by default.
- if (item.largeIconUrl) {
- item.largeIconUrl +=
- sizeInPx + "/" + item.renderViewId + "/" + item.rid;
- }
- if (item.fallbackIconUrl) {
- item.fallbackIconUrl +=
- sizeInPx + ",,,,/" + item.renderViewId + "/" + item.rid;
- }
- }
- return item;
- };
-
this.paste = function(value) {
Paste(value);
};
@@ -82,6 +60,7 @@ if (!chrome.embeddedSearch) {
native function CheckIsUserSignedInToChromeAs();
native function CheckIsUserSyncingHistory();
native function DeleteMostVisitedItem();
+ native function GetMostVisitedItemData();
native function GetMostVisitedItems();
native function GetThemeBackgroundInfo();
native function IsInputInProgress();
@@ -122,10 +101,6 @@ if (!chrome.embeddedSearch) {
this.__defineGetter__('mostVisited', GetMostVisitedItemsWrapper);
this.__defineGetter__('themeBackgroundInfo', GetThemeBackgroundInfo);
- this.deleteMostVisitedItem = function(restrictedId) {
- DeleteMostVisitedItem(restrictedId);
- };
-
this.checkIsUserSignedIntoChromeAs = function(identity) {
CheckIsUserSignedInToChromeAs(identity);
};
@@ -134,6 +109,30 @@ if (!chrome.embeddedSearch) {
CheckIsUserSyncingHistory();
};
+ this.deleteMostVisitedItem = function(restrictedId) {
+ DeleteMostVisitedItem(restrictedId);
+ };
+
+ // This method is restricted to chrome-search://most-visited pages by
+ // checking the invoking context's origin in searchbox_extension.cc.
+ this.getMostVisitedItemData = function(restrictedId) {
+ var item = GetMostVisitedItemData(restrictedId);
+ if (item) {
+ var sizeInPx = Math.floor(48 * window.devicePixelRatio + 0.5);
+ // Populate large icon and fallback icon data, if they exist. We'll
+ // render everything here, once these become available by default.
+ if (item.largeIconUrl) {
+ item.largeIconUrl +=
+ sizeInPx + "/" + item.renderViewId + "/" + item.rid;
+ }
+ if (item.fallbackIconUrl) {
+ item.fallbackIconUrl +=
+ sizeInPx + ",,,,/" + item.renderViewId + "/" + item.rid;
+ }
+ }
+ return item;
+ };
+
// This method is restricted to chrome-search://most-visited pages by
// checking the invoking context's origin in searchbox_extension.cc.
this.logEvent = function(histogram_name) {
« no previous file with comments | « chrome/browser/resources/local_ntp/most_visited_util.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698