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

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

Issue 10666009: Added already_open column to chrome://suggestions-internals. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Cleanup Created 8 years, 6 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/suggestions_internals/suggestions_internals.js
diff --git a/chrome/browser/resources/suggestions_internals/suggestions_internals.js b/chrome/browser/resources/suggestions_internals/suggestions_internals.js
index c4a0ed39a29dbed6edf42af57401b72d07c05aea..723143a0324c544bfc63e01cd443194dab84a56e 100644
--- a/chrome/browser/resources/suggestions_internals/suggestions_internals.js
+++ b/chrome/browser/resources/suggestions_internals/suggestions_internals.js
@@ -61,6 +61,16 @@ cr.define('suggestionsInternals', function() {
'score'
];
+ function setBooleanColumn(column, value) {
+ if (value) {
+ column.innerText = 'Y';
+ column.classList.add('boolean-property-true');
+ } else {
+ column.innerText = 'N';
+ column.classList.add('boolean-property-false');
+ }
+ }
+
/**
* Called by Chrome code, with a ranked list of suggestions. The columns
* to be displayed are calculated automatically from the properties of the
@@ -133,9 +143,11 @@ cr.define('suggestionsInternals', function() {
}
// Only add the column if the current suggestion has this property
// (otherwise, leave the cell empty).
- if (data) {
- // If the text is a URL, make it an anchor element.
- if (/^https?:\/\/.+$/.test(data)) {
+ if (typeof(data) != 'undefined') {
+ if (typeof(data) == 'boolean') {
+ setBooleanColumn(column, data);
+ } else if (/^https?:\/\/.+$/.test(data)) {
+ // If the text is a URL, make it an anchor element.
var anchor = document.createElement('a');
anchor.href = data;
anchor.innerText = data;
@@ -148,11 +160,8 @@ cr.define('suggestionsInternals', function() {
} else if (column_name == 'screenshot') {
var thumbnailUrl = 'chrome://thumb/' + entry.url;
var img = document.createElement('img');
- img.onload = function() {
- column.innerText = 'Y';
- column.classList.add('has-screenshot');
- }
- img.onerror = function() { column.innerText = 'N'; }
+ img.onload = function() { setBooleanColumn(column, true); }
+ img.onerror = function() { setBooleanColumn(column, false); }
img.src = thumbnailUrl;
} else if (column_name == 'favicon') {
var faviconUrl = 'chrome://favicon/size/16/' + entry.url;

Powered by Google App Engine
This is Rietveld 408576698