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

Side by Side Diff: chrome/browser/resources/history/history.js

Issue 2280853002: Slightly nicer icon.js APIs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 3 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 <include src="../uber/uber_utils.js"> 5 <include src="../uber/uber_utils.js">
6 <include src="history_focus_manager.js"> 6 <include src="history_focus_manager.js">
7 7
8 /////////////////////////////////////////////////////////////////////////////// 8 ///////////////////////////////////////////////////////////////////////////////
9 // Globals: 9 // Globals:
10 /** @const */ var RESULTS_PER_PAGE = 150; 10 /** @const */ var RESULTS_PER_PAGE = 150;
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 if (cr.isAndroid) { 455 if (cr.isAndroid) {
456 // On Android, if a large icon is unavailable, an HTML/CSS fallback favicon 456 // On Android, if a large icon is unavailable, an HTML/CSS fallback favicon
457 // is generated because Android does not yet support text drawing in native. 457 // is generated because Android does not yet support text drawing in native.
458 458
459 // Check whether a fallback favicon needs to be generated. 459 // Check whether a fallback favicon needs to be generated.
460 var desiredPixelSize = 32 * window.devicePixelRatio; 460 var desiredPixelSize = 32 * window.devicePixelRatio;
461 var img = new Image(); 461 var img = new Image();
462 img.onload = this.onLargeFaviconLoadedAndroid_.bind(this, faviconDiv); 462 img.onload = this.onLargeFaviconLoadedAndroid_.bind(this, faviconDiv);
463 img.src = 'chrome://large-icon/' + desiredPixelSize + '/' + this.url_; 463 img.src = 'chrome://large-icon/' + desiredPixelSize + '/' + this.url_;
464 } else { 464 } else {
465 faviconDiv.style.backgroundImage = cr.icon.getFaviconImageSet(this.url_); 465 faviconDiv.style.backgroundImage = cr.icon.getFavicon(this.url_);
466 } 466 }
467 }; 467 };
468 468
469 /** 469 /**
470 * Called when the chrome://large-icon image has finished loading. 470 * Called when the chrome://large-icon image has finished loading.
471 * @param {Element} faviconDiv The DOM element to add the favicon to. 471 * @param {Element} faviconDiv The DOM element to add the favicon to.
472 * @param {Event} event The onload event. 472 * @param {Event} event The onload event.
473 * @private 473 * @private
474 */ 474 */
475 Visit.prototype.onLargeFaviconLoadedAndroid_ = function(faviconDiv, event) { 475 Visit.prototype.onLargeFaviconLoadedAndroid_ = function(faviconDiv, event) {
(...skipping 1937 matching lines...) Expand 10 before | Expand all | Expand 10 after
2413 historyView.reload(); 2413 historyView.reload();
2414 } 2414 }
2415 2415
2416 // Add handlers to HTML elements. 2416 // Add handlers to HTML elements.
2417 document.addEventListener('DOMContentLoaded', load); 2417 document.addEventListener('DOMContentLoaded', load);
2418 2418
2419 // This event lets us enable and disable menu items before the menu is shown. 2419 // This event lets us enable and disable menu items before the menu is shown.
2420 document.addEventListener('canExecute', function(e) { 2420 document.addEventListener('canExecute', function(e) {
2421 e.canExecute = true; 2421 e.canExecute = true;
2422 }); 2422 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698