Chromium Code Reviews| 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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 326 | 326 |
| 327 function GetMostVisitedItemsWrapper() { | 327 function GetMostVisitedItemsWrapper() { |
| 328 var mostVisitedItems = GetMostVisitedItems(); | 328 var mostVisitedItems = GetMostVisitedItems(); |
| 329 for (var i = 0, item; item = mostVisitedItems[i]; ++i) { | 329 for (var i = 0, item; item = mostVisitedItems[i]; ++i) { |
| 330 var title = escapeHTML(item.title); | 330 var title = escapeHTML(item.title); |
| 331 var domain = escapeHTML(item.domain); | 331 var domain = escapeHTML(item.domain); |
| 332 // TODO(jered): Delete these Shadow DOM elements once the | 332 // TODO(jered): Delete these Shadow DOM elements once the |
| 333 // Google-provided NTP no longer depends on them. | 333 // Google-provided NTP no longer depends on them. |
| 334 item.titleElement = SafeWrapMostVisited(title, 140, item.direction); | 334 item.titleElement = SafeWrapMostVisited(title, 140, item.direction); |
| 335 item.domainElement = SafeWrapMostVisited(domain, 123); | 335 item.domainElement = SafeWrapMostVisited(domain, 123); |
| 336 item.faviconUrl = GenerateFaviconUrl(item.rid); | |
|
sreeram
2013/06/04 22:01:56
These Shadow DOM elements are going to be removed
pedro (no code reviews)
2013/06/07 23:34:21
The faviconUrl will be used as the background imag
| |
| 336 // These properties are private data and should not be returned to | 337 // These properties are private data and should not be returned to |
| 337 // the page. They are only accessible via getMostVisitedItemData(). | 338 // the page. They are only accessible via getMostVisitedItemData(). |
| 338 item.url = null; | 339 item.url = null; |
| 339 item.title = null; | 340 item.title = null; |
| 340 item.domain = null; | 341 item.domain = null; |
| 341 item.direction = null; | 342 item.direction = null; |
| 342 } | 343 } |
| 343 return mostVisitedItems; | 344 return mostVisitedItems; |
| 344 } | 345 } |
| 345 | 346 |
| 347 function GenerateFaviconUrl(rid) { | |
| 348 return "chrome-search://favicon/size/16@" + | |
| 349 window.devicePixelRatio + "x/" + rid; | |
| 350 } | |
| 351 | |
| 346 // ======================================================================= | 352 // ======================================================================= |
| 347 // Exported functions | 353 // Exported functions |
| 348 // ======================================================================= | 354 // ======================================================================= |
| 349 this.__defineGetter__('mostVisited', GetMostVisitedItemsWrapper); | 355 this.__defineGetter__('mostVisited', GetMostVisitedItemsWrapper); |
| 350 this.__defineGetter__('themeBackgroundInfo', GetThemeBackgroundInfo); | 356 this.__defineGetter__('themeBackgroundInfo', GetThemeBackgroundInfo); |
| 351 | 357 |
| 352 this.deleteMostVisitedItem = function(restrictedId) { | 358 this.deleteMostVisitedItem = function(restrictedId) { |
| 353 DeleteMostVisitedItem(restrictedId); | 359 DeleteMostVisitedItem(restrictedId); |
| 354 }; | 360 }; |
| 355 this.undoAllMostVisitedDeletions = function() { | 361 this.undoAllMostVisitedDeletions = function() { |
| 356 UndoAllMostVisitedDeletions(); | 362 UndoAllMostVisitedDeletions(); |
| 357 }; | 363 }; |
| 358 this.undoMostVisitedDeletion = function(restrictedId) { | 364 this.undoMostVisitedDeletion = function(restrictedId) { |
| 359 UndoMostVisitedDeletion(restrictedId); | 365 UndoMostVisitedDeletion(restrictedId); |
| 360 }; | 366 }; |
| 361 this.navigateContentWindow = function(destination, disposition) { | 367 this.navigateContentWindow = function(destination, disposition) { |
| 362 NavigateNewTabPage(destination, disposition); | 368 NavigateNewTabPage(destination, disposition); |
| 363 } | 369 } |
| 364 | 370 |
| 365 this.onmostvisitedchange = null; | 371 this.onmostvisitedchange = null; |
| 366 this.onthemechange = null; | 372 this.onthemechange = null; |
| 367 }; | 373 }; |
| 368 | 374 |
| 369 // Export legacy searchbox API. | 375 // Export legacy searchbox API. |
| 370 // TODO: Remove this when Instant Extended is fully launched. | 376 // TODO: Remove this when Instant Extended is fully launched. |
| 371 chrome.searchBox = this.searchBox; | 377 chrome.searchBox = this.searchBox; |
| 372 }; | 378 }; |
| 373 } | 379 } |
| OLD | NEW |