| 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 * @param {string} sortKey The name of the property to sort by. | 122 * @param {string} sortKey The name of the property to sort by. |
| 123 * @return {number} A negative number if |a| should be ordered before |b|, a | 123 * @return {number} A negative number if |a| should be ordered before |b|, a |
| 124 * positive number otherwise. | 124 * positive number otherwise. |
| 125 */ | 125 */ |
| 126 function compareTableItem(sortKey, a, b) { | 126 function compareTableItem(sortKey, a, b) { |
| 127 var val1 = a[sortKey]; | 127 var val1 = a[sortKey]; |
| 128 var val2 = b[sortKey]; | 128 var val2 = b[sortKey]; |
| 129 | 129 |
| 130 // Compare the hosts of the origin ignoring schemes. | 130 // Compare the hosts of the origin ignoring schemes. |
| 131 if (sortKey == 'origin') | 131 if (sortKey == 'origin') |
| 132 return new URL(val1).host > new URL(val2).host ? 1 : -1; | 132 return new URL(val1.url).host > new URL(val2.url).host ? 1 : -1; |
| 133 | 133 |
| 134 if (sortKey == 'score') | 134 if (sortKey == 'score') |
| 135 return val1 - val2; | 135 return val1 - val2; |
| 136 | 136 |
| 137 assertNotReached('Unsupported sort key: ' + sortKey); | 137 assertNotReached('Unsupported sort key: ' + sortKey); |
| 138 return 0; | 138 return 0; |
| 139 } | 139 } |
| 140 | 140 |
| 141 /** | 141 /** |
| 142 * Regenerates the engagement table from |info|. | 142 * Regenerates the engagement table from |info|. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 159 uiHandler.getSiteEngagementInfo().then(function(response) { | 159 uiHandler.getSiteEngagementInfo().then(function(response) { |
| 160 info = response.info; | 160 info = response.info; |
| 161 renderTable(info); | 161 renderTable(info); |
| 162 }); | 162 }); |
| 163 }; | 163 }; |
| 164 | 164 |
| 165 updateEngagementTable(); | 165 updateEngagementTable(); |
| 166 enableAutoupdate(); | 166 enableAutoupdate(); |
| 167 }; | 167 }; |
| 168 }); | 168 }); |
| OLD | NEW |