| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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('options', function() { | 5 cr.define('options', function() { |
| 6 'use strict'; | 6 'use strict'; |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * A lookup helper function to find the first node that has an id (starting | 9 * A lookup helper function to find the first node that has an id (starting |
| 10 * at |node| and going up the parent chain). | 10 * at |node| and going up the parent chain). |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 var trashTemplate = $('template-collection').querySelector('.trash'); | 179 var trashTemplate = $('template-collection').querySelector('.trash'); |
| 180 var trash = trashTemplate.cloneNode(true); | 180 var trash = trashTemplate.cloneNode(true); |
| 181 trash.title = loadTimeData.getString('extensionUninstall'); | 181 trash.title = loadTimeData.getString('extensionUninstall'); |
| 182 trash.addEventListener('click', function(e) { | 182 trash.addEventListener('click', function(e) { |
| 183 chrome.send('extensionSettingsUninstall', [extension.id]); | 183 chrome.send('extensionSettingsUninstall', [extension.id]); |
| 184 }); | 184 }); |
| 185 node.querySelector('.enable-controls').appendChild(trash); | 185 node.querySelector('.enable-controls').appendChild(trash); |
| 186 | 186 |
| 187 // Developer mode //////////////////////////////////////////////////////// | 187 // Developer mode //////////////////////////////////////////////////////// |
| 188 | 188 |
| 189 // First we have the id. | 189 // First, display the id. |
| 190 var idLabel = node.querySelector('.extension-id'); | 190 var idLabel = node.querySelector('.extension-id'); |
| 191 idLabel.textContent = ' ' + extension.id; | 191 idLabel.textContent = ' ' + extension.id; |
| 192 | 192 |
| 193 // Then the path, if provided by unpacked extension. | 193 // Then, display the path, if provided by unpacked extension. |
| 194 if (extension.isUnpacked) { | 194 if (extension.isUnpacked) { |
| 195 var loadPath = node.querySelector('.load-path'); | 195 var loadPath = node.querySelector('.load-path'); |
| 196 loadPath.hidden = false; | 196 loadPath.hidden = false; |
| 197 loadPath.querySelector('span:nth-of-type(2)').textContent = | 197 loadPath.querySelector('span:nth-of-type(2)').textContent = |
| 198 ' ' + extension.path; | 198 ' ' + extension.path; |
| 199 } | 199 } |
| 200 | 200 |
| 201 // Then the 'managed, cannot uninstall/disable' message. | 201 // Then, display the 'managed, cannot uninstall/disable' message. |
| 202 if (!extension.mayDisable) | 202 if (!extension.mayDisable) |
| 203 node.querySelector('.managed-message').hidden = false; | 203 node.querySelector('.managed-message').hidden = false; |
| 204 | 204 |
| 205 // Then active views. | 205 // Then, display active views. |
| 206 if (extension.views.length > 0) { | 206 if (extension.views.length > 0) { |
| 207 var activeViews = node.querySelector('.active-views'); | 207 var activeViews = node.querySelector('.active-views'); |
| 208 activeViews.hidden = false; | 208 activeViews.hidden = false; |
| 209 var link = activeViews.querySelector('a'); | 209 var link = activeViews.querySelector('a'); |
| 210 | 210 |
| 211 extension.views.forEach(function(view, i) { | 211 extension.views.forEach(function(view, i) { |
| 212 var label = view.path + | 212 var label = view.path + |
| 213 (view.incognito ? | 213 (view.incognito ? |
| 214 ' ' + loadTimeData.getString('viewIncognito') : '') + | 214 ' ' + loadTimeData.getString('viewIncognito') : '') + |
| 215 (view.renderProcessId == -1 ? | 215 (view.renderProcessId == -1 ? |
| 216 ' ' + loadTimeData.getString('viewInactive') : ''); | 216 ' ' + loadTimeData.getString('viewInactive') : ''); |
| 217 link.textContent = label; | 217 link.textContent = label; |
| 218 link.addEventListener('click', function(e) { | 218 link.addEventListener('click', function(e) { |
| 219 // TODO(estade): remove conversion to string? | 219 // TODO(estade): remove conversion to string? |
| 220 chrome.send('extensionSettingsInspect', [ | 220 chrome.send('extensionSettingsInspect', [ |
| 221 String(extension.id), | 221 String(extension.id), |
| 222 String(view.renderProcessId), | 222 String(view.renderProcessId), |
| 223 String(view.renderViewId), | 223 String(view.renderViewId), |
| 224 view.incognito | 224 view.incognito |
| 225 ]); | 225 ]); |
| 226 }); | 226 }); |
| 227 | 227 |
| 228 if (i < extension.views.length - 1) { | 228 if (i < extension.views.length - 1) { |
| 229 link = link.cloneNode(true); | 229 link = link.cloneNode(true); |
| 230 activeViews.appendChild(link); | 230 activeViews.appendChild(link); |
| 231 } | 231 } |
| 232 }); | 232 }); |
| 233 } | 233 } |
| 234 | 234 |
| 235 // The install warnings. | 235 // Then, display install warnings. |
| 236 if (extension.installWarnings) { | 236 if (extension.installWarnings) { |
| 237 var panel = node.querySelector('.install-warnings'); | 237 var panel = node.querySelector('.install-warnings'); |
| 238 panel.hidden = false; | 238 panel.hidden = false; |
| 239 var list = panel.querySelector('ul'); | 239 var list = panel.querySelector('ul'); |
| 240 extension.installWarnings.forEach(function(warning) { | 240 extension.installWarnings.forEach(function(warning) { |
| 241 list.appendChild(document.createElement('li')).innerText = warning; | 241 list.appendChild(document.createElement('li')).innerText = warning; |
| 242 }); | 242 }); |
| 243 } | 243 } |
| 244 | 244 |
| 245 // Finally, display the unrecognized manifest keys. |
| 246 if (extension.unrecognizedKeys) { |
| 247 var unrecognizedKeys = node.querySelector('.unrecognized-keys'); |
| 248 unrecognizedKeys.hidden = false; |
| 249 var list = unrecognizedKeys.querySelector('ul'); |
| 250 extension.unrecognizedKeys.forEach(function(key) { |
| 251 list.appendChild(document.createElement('li')).innerText = key; |
| 252 }); |
| 253 } |
| 254 |
| 245 this.appendChild(node); | 255 this.appendChild(node); |
| 246 }, | 256 }, |
| 247 }; | 257 }; |
| 248 | 258 |
| 249 return { | 259 return { |
| 250 ExtensionsList: ExtensionsList | 260 ExtensionsList: ExtensionsList |
| 251 }; | 261 }; |
| 252 }); | 262 }); |
| OLD | NEW |