| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 cr.define('identity_internals', function() { | 5 cr.define('identity_internals', function() { |
| 6 'use strict'; | 6 'use strict'; |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * Creates an identity token item. | 9 * Creates an identity token item. |
| 10 * @param {!Object} tokenInfo Object containing token information. | 10 * @param {!Object} tokenInfo Object containing token information. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 this.id = this.data_.accessToken; | 27 this.id = this.data_.accessToken; |
| 28 | 28 |
| 29 var table = this.ownerDocument.createElement('table'); | 29 var table = this.ownerDocument.createElement('table'); |
| 30 var tbody = this.ownerDocument.createElement('tbody'); | 30 var tbody = this.ownerDocument.createElement('tbody'); |
| 31 tbody.appendChild(this.createEntry_( | 31 tbody.appendChild(this.createEntry_( |
| 32 'accessToken', this.data_.accessToken, 'access-token')); | 32 'accessToken', this.data_.accessToken, 'access-token')); |
| 33 tbody.appendChild(this.createEntry_( | 33 tbody.appendChild(this.createEntry_( |
| 34 'extensionName', this.data_.extensionName, 'extension-name')); | 34 'extensionName', this.data_.extensionName, 'extension-name')); |
| 35 tbody.appendChild(this.createEntry_( | 35 tbody.appendChild(this.createEntry_( |
| 36 'extensionId', this.data_.extensionId, 'extension-id')); | 36 'extensionId', this.data_.extensionId, 'extension-id')); |
| 37 tbody.appendChild(this.createEntry_( | 37 tbody.appendChild( |
| 38 'tokenStatus', this.data_.status, 'token-status')); | 38 this.createEntry_('tokenStatus', this.data_.status, 'token-status')); |
| 39 tbody.appendChild(this.createEntry_( | 39 tbody.appendChild(this.createEntry_( |
| 40 'expirationTime', this.data_.expirationTime, 'expiration-time')); | 40 'expirationTime', this.data_.expirationTime, 'expiration-time')); |
| 41 tbody.appendChild(this.createEntryForScopes_()); | 41 tbody.appendChild(this.createEntryForScopes_()); |
| 42 table.appendChild(tbody); | 42 table.appendChild(tbody); |
| 43 var tfoot = this.ownerDocument.createElement('tfoot'); | 43 var tfoot = this.ownerDocument.createElement('tfoot'); |
| 44 tfoot.appendChild(this.createButtons_()); | 44 tfoot.appendChild(this.createButtons_()); |
| 45 table.appendChild(tfoot); | 45 table.appendChild(tfoot); |
| 46 this.appendChild(table); | 46 this.appendChild(table); |
| 47 }, | 47 }, |
| 48 | 48 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 /** | 106 /** |
| 107 * Creates a revoke button with an event sending a revoke token message | 107 * Creates a revoke button with an event sending a revoke token message |
| 108 * to the controller. | 108 * to the controller. |
| 109 * @return {!HTMLButtonElement} The created revoke button. | 109 * @return {!HTMLButtonElement} The created revoke button. |
| 110 * @private | 110 * @private |
| 111 */ | 111 */ |
| 112 createRevokeButton_: function() { | 112 createRevokeButton_: function() { |
| 113 var revokeButton = this.ownerDocument.createElement('button'); | 113 var revokeButton = this.ownerDocument.createElement('button'); |
| 114 revokeButton.classList.add('revoke-button'); | 114 revokeButton.classList.add('revoke-button'); |
| 115 revokeButton.addEventListener('click', function() { | 115 revokeButton.addEventListener('click', function() { |
| 116 chrome.send('identityInternalsRevokeToken', | 116 chrome.send( |
| 117 [this.data_.extensionId, this.data_.accessToken]); | 117 'identityInternalsRevokeToken', |
| 118 [this.data_.extensionId, this.data_.accessToken]); |
| 118 }.bind(this)); | 119 }.bind(this)); |
| 119 revokeButton.textContent = loadTimeData.getString('revoke'); | 120 revokeButton.textContent = loadTimeData.getString('revoke'); |
| 120 return revokeButton; | 121 return revokeButton; |
| 121 }, | 122 }, |
| 122 }; | 123 }; |
| 123 | 124 |
| 124 /** | 125 /** |
| 125 * Creates a new list of identity tokens. | 126 * Creates a new list of identity tokens. |
| 126 * @param {Object=} opt_propertyBag Optional properties. | 127 * @param {Object=} opt_propertyBag Optional properties. |
| 127 * @constructor | 128 * @constructor |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 | 208 |
| 208 // Return an object with all of the exports. | 209 // Return an object with all of the exports. |
| 209 return { | 210 return { |
| 210 initialize: initialize, | 211 initialize: initialize, |
| 211 returnTokens: returnTokens, | 212 returnTokens: returnTokens, |
| 212 tokenRevokeDone: tokenRevokeDone, | 213 tokenRevokeDone: tokenRevokeDone, |
| 213 }; | 214 }; |
| 214 }); | 215 }); |
| 215 | 216 |
| 216 document.addEventListener('DOMContentLoaded', identity_internals.initialize); | 217 document.addEventListener('DOMContentLoaded', identity_internals.initialize); |
| OLD | NEW |