| Index: chrome/browser/resources/settings/site_settings/cookie_info.js
|
| diff --git a/chrome/browser/resources/settings/site_settings/cookie_info.js b/chrome/browser/resources/settings/site_settings/cookie_info.js
|
| index f78e161f278db19ce3d2f656250b9f800e225417..e50692f854684106dc2057ade586ba77bce51b96 100644
|
| --- a/chrome/browser/resources/settings/site_settings/cookie_info.js
|
| +++ b/chrome/browser/resources/settings/site_settings/cookie_info.js
|
| @@ -2,6 +2,21 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| +/**
|
| + * @typedef {{hasChildren: boolean,
|
| + * id: string,
|
| + * title: string,
|
| + * totalUsage: string,
|
| + * type: string}}
|
| + */
|
| +var CookieDetails;
|
| +
|
| +/**
|
| + * @typedef {{content: string,
|
| + * label: string}}
|
| + */
|
| +var CookieDataForDisplay;
|
| +
|
| // This structure maps the various cookie type names from C++ (hence the
|
| // underscores) to arrays of the different types of data each has, along with
|
| // the i18n name for the description of that data type.
|
| @@ -49,3 +64,28 @@
|
| ['size', 'mediaLicenseSize'],
|
| ['modified', 'mediaLicenseLastModified']],
|
| };
|
| +
|
| +/**
|
| + * Get cookie data for a given HTML node.
|
| + * @param {CookieDetails} data The contents of the cookie.
|
| + * @return {!Array<CookieDataForDisplay>}
|
| + */
|
| +var getCookieData = function(data) {
|
| + /** @type {!Array<CookieDataForDisplay>} */
|
| + var out = [];
|
| + var fields = cookieInfo[data.type];
|
| + for (var field of fields) {
|
| + // Iterate through the keys found in |cookieInfo| for the given |type|
|
| + // and see if those keys are present in the data. If so, display them
|
| + // (in the order determined by |cookieInfo|).
|
| + var key = field[0];
|
| + if (data[key].length > 0) {
|
| + var entry = /** @type {CookieDataForDisplay} */({
|
| + label: loadTimeData.getString(field[1]),
|
| + content: data[key],
|
| + });
|
| + out.push(entry);
|
| + }
|
| + }
|
| + return out;
|
| +};
|
|
|