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

Unified Diff: chrome/browser/resources/history/history.js

Issue 22862006: "domain" item added to HistoryEntry to allow showing IDN in chrome://history/ (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/history/history.js
===================================================================
--- chrome/browser/resources/history/history.js (revision 216076)
+++ chrome/browser/resources/history/history.js (working copy)
@@ -87,6 +87,7 @@
this.model_ = model;
this.title_ = result.title;
this.url_ = result.url;
+ this.domain_ = result.domain;
this.starred_ = result.starred;
this.snippet_ = result.snippet || '';
@@ -176,7 +177,7 @@
menu.dataset.devicename = self.deviceName;
menu.dataset.devicetype = self.deviceType;
};
- domain.textContent = this.getDomainFromURL_(this.url_);
+ domain.textContent = this.domain_;
entryBox.appendChild(time);
@@ -282,19 +283,6 @@
// Visit, private: ------------------------------------------------------------
/**
- * Extracts and returns the domain (and subdomains) from a URL.
- * @param {string} url The url.
- * @return {string} The domain. An empty string is returned if no domain can
- * be found.
- * @private
- */
-Visit.prototype.getDomainFromURL_ = function(url) {
- // TODO(sergiu): Extract the domain from the C++ side and send it here.
- var domain = url.replace(/^.+?:\/\//, '').match(/[^/]+/);
- return domain ? domain[0] : '';
-};
-
-/**
* Add child text nodes to a node such that occurrences of the specified text is
* highlighted.
* @param {Node} node The node under which new text nodes will be made as
@@ -375,7 +363,7 @@
node.innerHTML = loadTimeData.getStringF('blockedVisitText',
this.url_,
this.id_,
- this.getDomainFromURL_(this.url_));
+ this.domain_);
return node;
};
@@ -397,7 +385,7 @@
*/
Visit.prototype.showMoreFromSite_ = function() {
recordUmaAction('HistoryPage_EntryMenuShowMoreFromSite');
- historyView.setSearch(this.getDomainFromURL_(this.url_));
+ historyView.setSearch(this.domain_);
};
// Visit, private, static: ----------------------------------------------------
@@ -1124,7 +1112,7 @@
// Group the visits into a dictionary and generate a list of domains.
for (var i = 0, visit; visit = visits[i]; i++) {
- var domain = visit.getDomainFromURL_(visit.url_);
+ var domain = visit.domain_;
if (!visitsByDomain[domain]) {
visitsByDomain[domain] = [];
domains.push(domain);

Powered by Google App Engine
This is Rietveld 408576698