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

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

Issue 2681723002: NTP Cleanup: Remove support for "icons" layout (Closed)
Patch Set: Created 3 years, 10 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/browser/resources/local_ntp/most_visited_util.js ('k') | no next file » | 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() {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 for (var i = 0, item; item = mostVisitedItems[i]; ++i) { 75 for (var i = 0, item; item = mostVisitedItems[i]; ++i) {
76 item.faviconUrl = GenerateFaviconURL(item.renderViewId, item.rid); 76 item.faviconUrl = GenerateFaviconURL(item.renderViewId, item.rid);
77 77
78 // These properties are private data and should not be returned to 78 // These properties are private data and should not be returned to
79 // the page. They are only accessible via getMostVisitedItemData(). 79 // the page. They are only accessible via getMostVisitedItemData().
80 delete item.url; 80 delete item.url;
81 delete item.title; 81 delete item.title;
82 delete item.domain; 82 delete item.domain;
83 delete item.direction; 83 delete item.direction;
84 delete item.renderViewId; 84 delete item.renderViewId;
85 delete item.largeIconUrl;
86 delete item.fallbackIconUrl;
87 } 85 }
88 return mostVisitedItems; 86 return mostVisitedItems;
89 } 87 }
90 88
91 function GenerateFaviconURL(renderViewId, rid) { 89 function GenerateFaviconURL(renderViewId, rid) {
92 return "chrome-search://favicon/size/16@" + 90 return "chrome-search://favicon/size/16@" +
93 window.devicePixelRatio + "x/" + 91 window.devicePixelRatio + "x/" +
94 renderViewId + "/" + rid; 92 renderViewId + "/" + rid;
95 } 93 }
96 94
(...skipping 11 matching lines...) Expand all
108 this.checkIsUserSyncingHistory = function() { 106 this.checkIsUserSyncingHistory = function() {
109 CheckIsUserSyncingHistory(); 107 CheckIsUserSyncingHistory();
110 }; 108 };
111 109
112 this.deleteMostVisitedItem = function(restrictedId) { 110 this.deleteMostVisitedItem = function(restrictedId) {
113 DeleteMostVisitedItem(restrictedId); 111 DeleteMostVisitedItem(restrictedId);
114 }; 112 };
115 113
116 // This method is restricted to chrome-search://most-visited pages by 114 // This method is restricted to chrome-search://most-visited pages by
117 // checking the invoking context's origin in searchbox_extension.cc. 115 // checking the invoking context's origin in searchbox_extension.cc.
118 this.getMostVisitedItemData = function(restrictedId) { 116 this.getMostVisitedItemData = function(restrictedId) {
mastiz 2017/02/08 13:59:22 Seems like the signature matches. Do you even need
Marc Treib 2017/02/08 14:02:48 The inner GetMostVisitedItemData is a native funct
119 var item = GetMostVisitedItemData(restrictedId); 117 return GetMostVisitedItemData(restrictedId);
120 if (item) {
121 var sizeInPx = Math.floor(48 * window.devicePixelRatio + 0.5);
122 // Populate large icon and fallback icon data, if they exist. We'll
123 // render everything here, once these become available by default.
124 if (item.largeIconUrl) {
125 item.largeIconUrl +=
126 sizeInPx + "/" + item.renderViewId + "/" + item.rid;
127 }
128 if (item.fallbackIconUrl) {
129 item.fallbackIconUrl +=
130 sizeInPx + ",,,,/" + item.renderViewId + "/" + item.rid;
131 }
132 }
133 return item;
134 }; 118 };
135 119
136 // This method is restricted to chrome-search://most-visited pages by 120 // This method is restricted to chrome-search://most-visited pages by
137 // checking the invoking context's origin in searchbox_extension.cc. 121 // checking the invoking context's origin in searchbox_extension.cc.
138 this.logEvent = function(histogram_name) { 122 this.logEvent = function(histogram_name) {
139 LogEvent(histogram_name); 123 LogEvent(histogram_name);
140 }; 124 };
141 125
142 // This method is restricted to chrome-search://most-visited pages by 126 // This method is restricted to chrome-search://most-visited pages by
143 // checking the invoking context's origin in searchbox_extension.cc. 127 // checking the invoking context's origin in searchbox_extension.cc.
(...skipping 20 matching lines...) Expand all
164 this.oninputcancel = null; 148 this.oninputcancel = null;
165 this.oninputstart = null; 149 this.oninputstart = null;
166 this.onmostvisitedchange = null; 150 this.onmostvisitedchange = null;
167 this.onthemechange = null; 151 this.onthemechange = null;
168 }; 152 };
169 153
170 // TODO(jered): Remove when google no longer expects this object. 154 // TODO(jered): Remove when google no longer expects this object.
171 chrome.searchBox = this.searchBox; 155 chrome.searchBox = this.searchBox;
172 }; 156 };
173 } 157 }
OLDNEW
« 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