| 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() { |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 native function DeleteMostVisitedItem(); | 256 native function DeleteMostVisitedItem(); |
| 257 native function UndoAllMostVisitedDeletions(); | 257 native function UndoAllMostVisitedDeletions(); |
| 258 native function UndoMostVisitedDeletion(); | 258 native function UndoMostVisitedDeletion(); |
| 259 native function NavigateNewTabPage(); | 259 native function NavigateNewTabPage(); |
| 260 native function IsInputInProgress(); | 260 native function IsInputInProgress(); |
| 261 native function GetAppLauncherEnabled(); | 261 native function GetAppLauncherEnabled(); |
| 262 | 262 |
| 263 function GetMostVisitedItemsWrapper() { | 263 function GetMostVisitedItemsWrapper() { |
| 264 var mostVisitedItems = GetMostVisitedItems(); | 264 var mostVisitedItems = GetMostVisitedItems(); |
| 265 for (var i = 0, item; item = mostVisitedItems[i]; ++i) { | 265 for (var i = 0, item; item = mostVisitedItems[i]; ++i) { |
| 266 item.faviconUrl = GenerateThumbnailURL(item.renderViewId, item.rid); |
| 266 // These properties are private data and should not be returned to | 267 // These properties are private data and should not be returned to |
| 267 // the page. They are only accessible via getMostVisitedItemData(). | 268 // the page. They are only accessible via getMostVisitedItemData(). |
| 268 item.url = null; | 269 item.url = null; |
| 269 item.title = null; | 270 item.title = null; |
| 270 item.domain = null; | 271 item.domain = null; |
| 271 item.direction = null; | 272 item.direction = null; |
| 273 item.renderViewId = null; |
| 272 } | 274 } |
| 273 return mostVisitedItems; | 275 return mostVisitedItems; |
| 274 } | 276 } |
| 275 | 277 |
| 278 function GenerateThumbnailURL(renderViewId, rid) { |
| 279 return "chrome-search://favicon/size/16@" + |
| 280 window.devicePixelRatio + "x/" + |
| 281 renderViewId + "/" + rid; |
| 282 } |
| 283 |
| 276 // ======================================================================= | 284 // ======================================================================= |
| 277 // Exported functions | 285 // Exported functions |
| 278 // ======================================================================= | 286 // ======================================================================= |
| 279 this.__defineGetter__('mostVisited', GetMostVisitedItemsWrapper); | 287 this.__defineGetter__('mostVisited', GetMostVisitedItemsWrapper); |
| 280 this.__defineGetter__('themeBackgroundInfo', GetThemeBackgroundInfo); | 288 this.__defineGetter__('themeBackgroundInfo', GetThemeBackgroundInfo); |
| 281 this.__defineGetter__('isInputInProgress', IsInputInProgress); | 289 this.__defineGetter__('isInputInProgress', IsInputInProgress); |
| 282 this.__defineGetter__('appLauncherEnabled', GetAppLauncherEnabled); | 290 this.__defineGetter__('appLauncherEnabled', GetAppLauncherEnabled); |
| 283 | 291 |
| 284 this.deleteMostVisitedItem = function(restrictedId) { | 292 this.deleteMostVisitedItem = function(restrictedId) { |
| 285 DeleteMostVisitedItem(restrictedId); | 293 DeleteMostVisitedItem(restrictedId); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 298 this.onthemechange = null; | 306 this.onthemechange = null; |
| 299 this.oninputstart = null; | 307 this.oninputstart = null; |
| 300 this.oninputcancel = null; | 308 this.oninputcancel = null; |
| 301 }; | 309 }; |
| 302 | 310 |
| 303 // Export legacy searchbox API. | 311 // Export legacy searchbox API. |
| 304 // TODO: Remove this when Instant Extended is fully launched. | 312 // TODO: Remove this when Instant Extended is fully launched. |
| 305 chrome.searchBox = this.searchBox; | 313 chrome.searchBox = this.searchBox; |
| 306 }; | 314 }; |
| 307 } | 315 } |
| OLD | NEW |