| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 'use strict'; | 5 'use strict'; |
| 6 | 6 |
| 7 define('main', [ | 7 define('main', [ |
| 8 'mojo/public/js/connection', | 8 'mojo/public/js/connection', |
| 9 'chrome/browser/ui/webui/engagement/site_engagement.mojom', | 9 'chrome/browser/ui/webui/engagement/site_engagement.mojom', |
| 10 'content/public/renderer/frame_service_registry', | 10 'content/public/renderer/frame_service_registry', |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 }); | 44 }); |
| 45 } | 45 } |
| 46 | 46 |
| 47 /** | 47 /** |
| 48 * Creates a single row in the engagement table. | 48 * Creates a single row in the engagement table. |
| 49 * @param {SiteEngagementInfo} info The info to create the row from. | 49 * @param {SiteEngagementInfo} info The info to create the row from. |
| 50 * @return {HTMLElement} | 50 * @return {HTMLElement} |
| 51 */ | 51 */ |
| 52 function createRow(info) { | 52 function createRow(info) { |
| 53 var originCell = createElementWithClassName('td', 'origin-cell'); | 53 var originCell = createElementWithClassName('td', 'origin-cell'); |
| 54 originCell.textContent = info.origin; | 54 originCell.textContent = info.origin.url; |
| 55 | 55 |
| 56 var scoreInput = createElementWithClassName('input', 'score-input'); | 56 var scoreInput = createElementWithClassName('input', 'score-input'); |
| 57 scoreInput.addEventListener( | 57 scoreInput.addEventListener( |
| 58 'change', handleScoreChange.bind(undefined, info.origin)); | 58 'change', handleScoreChange.bind(undefined, info.origin)); |
| 59 scoreInput.value = info.score; | 59 scoreInput.value = info.score; |
| 60 | 60 |
| 61 var scoreCell = createElementWithClassName('td', 'score-cell'); | 61 var scoreCell = createElementWithClassName('td', 'score-cell'); |
| 62 scoreCell.appendChild(scoreInput); | 62 scoreCell.appendChild(scoreInput); |
| 63 | 63 |
| 64 var engagementBar = createElementWithClassName('div', 'engagement-bar'); | 64 var engagementBar = createElementWithClassName('div', 'engagement-bar'); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 uiHandler.getSiteEngagementInfo().then(function(response) { | 146 uiHandler.getSiteEngagementInfo().then(function(response) { |
| 147 info = response.info; | 147 info = response.info; |
| 148 renderTable(info); | 148 renderTable(info); |
| 149 }); | 149 }); |
| 150 }; | 150 }; |
| 151 | 151 |
| 152 updateEngagementTable(); | 152 updateEngagementTable(); |
| 153 updateInterval = setInterval(updateEngagementTable, 5000); | 153 updateInterval = setInterval(updateEngagementTable, 5000); |
| 154 }; | 154 }; |
| 155 }); | 155 }); |
| OLD | NEW |