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

Side by Side Diff: components/physical_web/webui/resources/physical_web.js

Issue 2717363003: Add Physical Web WebUI Default Url Icon (Closed)
Patch Set: use image directly Created 3 years, 9 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) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 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 /** 5 /**
6 * Takes the |nearbyUrlsData| input argument which holds metadata for web pages 6 * Takes the |nearbyUrlsData| input argument which holds metadata for web pages
7 * broadcast by nearby devices. 7 * broadcast by nearby devices.
8 * @param {Object} nearbyUrlsData Information about web pages broadcast by 8 * @param {Object} nearbyUrlsData Information about web pages broadcast by
9 * nearby devices 9 * nearby devices
10 */ 10 */
(...skipping 12 matching lines...) Expand all
23 23
24 function returnNearbyURLs(nearbyUrlsData) { 24 function returnNearbyURLs(nearbyUrlsData) {
25 var bodyContainer = $('body-container'); 25 var bodyContainer = $('body-container');
26 renderTemplate(nearbyUrlsData); 26 renderTemplate(nearbyUrlsData);
27 bodyContainer.hidden = false; 27 bodyContainer.hidden = false;
28 28
29 if (nearbyUrlsData['metadata'].length == 0) { 29 if (nearbyUrlsData['metadata'].length == 0) {
30 var emptyMessage = $('empty-list-container'); 30 var emptyMessage = $('empty-list-container');
31 emptyMessage.hidden = false; 31 emptyMessage.hidden = false;
32 } 32 }
33 assignImageLoadErrorHandlers();
34 }
35
36 function assignImageLoadErrorHandlers() {
37 var pwIcons = document.querySelectorAll('.physicalWebIcon');
38 pwIcons.forEach(function(e) {
39 let img = e.getElementsByTagName('img')[0];
mmocny 2017/03/23 20:58:39 Could we just change the querySelectorAll to do th
Ran 2017/03/24 17:48:29 Done.
40 img.addEventListener('error', function() {
41 img.src =
42 'chrome://physical-web/ic_link_grey600_36dp.png';
43 });
44 });
33 } 45 }
34 46
35 document.addEventListener('DOMContentLoaded', requestNearbyURLs); 47 document.addEventListener('DOMContentLoaded', requestNearbyURLs);
OLDNEW
« no previous file with comments | « components/physical_web/webui/physical_web_ui_constants.cc ('k') | components/resources/physical_web_ui_resources.grdp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698