| 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('apps_dev_tool', function() { | 5 cr.define('apps_dev_tool', function() { |
| 6 'use strict'; | 6 'use strict'; |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * Creates a new list of items. | 9 * Creates a new list of items. |
| 10 * @param {Object=} opt_propertyBag Optional properties. | 10 * @param {Object=} opt_propertyBag Optional properties. |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 if (item.isApp) | 139 if (item.isApp) |
| 140 ItemsList.launchApp(item.id); | 140 ItemsList.launchApp(item.id); |
| 141 }; | 141 }; |
| 142 | 142 |
| 143 var version = node.querySelector('.extension-version'); | 143 var version = node.querySelector('.extension-version'); |
| 144 version.textContent = item.version; | 144 version.textContent = item.version; |
| 145 | 145 |
| 146 var description = node.querySelector('.extension-description span'); | 146 var description = node.querySelector('.extension-description span'); |
| 147 description.textContent = item.description; | 147 description.textContent = item.description; |
| 148 | 148 |
| 149 // The 'allow in incognito' checkbox. |
| 150 this.setAllowIncognitoCheckbox_(item, node); |
| 151 |
| 149 // The 'allow file:// access' checkbox. | 152 // The 'allow file:// access' checkbox. |
| 150 if (item.wants_file_access) | 153 if (item.wants_file_access) |
| 151 this.setAllowFileAccessCheckbox_(item, node); | 154 this.setAllowFileAccessCheckbox_(item, node); |
| 152 | 155 |
| 153 // The 'Options' checkbox. | 156 // The 'Options' checkbox. |
| 154 if (item.enabled && item.options_url) { | 157 if (item.enabled && item.options_url) { |
| 155 var options = node.querySelector('.options-link'); | 158 var options = node.querySelector('.options-link'); |
| 156 options.href = item.options_url; | 159 options.href = item.options_url; |
| 157 options.hidden = false; | 160 options.hidden = false; |
| 158 } | 161 } |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 setAllowFileAccessCheckbox_: function(item, el) { | 311 setAllowFileAccessCheckbox_: function(item, el) { |
| 309 var fileAccess = el.querySelector('.file-access-control'); | 312 var fileAccess = el.querySelector('.file-access-control'); |
| 310 fileAccess.addEventListener('click', function(e) { | 313 fileAccess.addEventListener('click', function(e) { |
| 311 chrome.developerPrivate.allowFileAccess(item.id, !!e.target.checked); | 314 chrome.developerPrivate.allowFileAccess(item.id, !!e.target.checked); |
| 312 }); | 315 }); |
| 313 fileAccess.querySelector('input').checked = item.allow_file_access; | 316 fileAccess.querySelector('input').checked = item.allow_file_access; |
| 314 fileAccess.hidden = false; | 317 fileAccess.hidden = false; |
| 315 }, | 318 }, |
| 316 | 319 |
| 317 /** | 320 /** |
| 321 * Sets the handler for the allow_incognito checkbox. |
| 322 * @param {!Object} item A dictionary of item metadata. |
| 323 * @param {HTMLElement} el HTML element containing all items. |
| 324 * @private |
| 325 */ |
| 326 setAllowIncognitoCheckbox_: function(item, el) { |
| 327 if (item.allow_incognito) { |
| 328 var incognito = el.querySelector('.incognito-control'); |
| 329 incognito.addEventListener('change', function(e) { |
| 330 chrome.developerPrivate.allowIncognito( |
| 331 item.id, !!e.target.checked, function() { |
| 332 ItemsList.loadItemsInfo(); |
| 333 }); |
| 334 }); |
| 335 incognito.querySelector('input').checked = item.incognito_enabled; |
| 336 incognito.hidden = false; |
| 337 } |
| 338 }, |
| 339 |
| 340 /** |
| 318 * Sets the active views link of an item. Clicking on the link | 341 * Sets the active views link of an item. Clicking on the link |
| 319 * opens devtools window to inspect. | 342 * opens devtools window to inspect. |
| 320 * @param {!Object} item A dictionary of item metadata. | 343 * @param {!Object} item A dictionary of item metadata. |
| 321 * @param {HTMLElement} el HTML element containing all items. | 344 * @param {HTMLElement} el HTML element containing all items. |
| 322 * @private | 345 * @private |
| 323 */ | 346 */ |
| 324 setActiveViews_: function(item, el) { | 347 setActiveViews_: function(item, el) { |
| 325 if (!item.views.length) | 348 if (!item.views.length) |
| 326 return; | 349 return; |
| 327 | 350 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 */ | 401 */ |
| 379 ItemsList.launchApp = function(id) { | 402 ItemsList.launchApp = function(id) { |
| 380 chrome.management.launchApp(id); | 403 chrome.management.launchApp(id); |
| 381 ItemsList.loadItemsInfo(); | 404 ItemsList.loadItemsInfo(); |
| 382 }; | 405 }; |
| 383 | 406 |
| 384 return { | 407 return { |
| 385 ItemsList: ItemsList, | 408 ItemsList: ItemsList, |
| 386 }; | 409 }; |
| 387 }); | 410 }); |
| OLD | NEW |