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

Side by Side Diff: chrome/browser/resources/engagement/site_engagement.js

Issue 2104783002: Construct URLs from the url field when sorting site engagement by origin. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 });
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698