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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 * Sets the handler for the allow_file_access checkbox. | 287 * Sets the handler for the allow_file_access checkbox. |
285 * @param {!Object} item A dictionary of item metadata. | 288 * @param {!Object} item A dictionary of item metadata. |
286 * @param {HTMLElement} el HTML element containing all items. | 289 * @param {HTMLElement} el HTML element containing all items. |
287 * @private | 290 * @private |
288 */ | 291 */ |
289 setAllowFileAccessCheckbox_: function(item, el) { | 292 setAllowFileAccessCheckbox_: function(item, el) { |
290 var fileAccess = el.querySelector('.file-access-control'); | 293 var fileAccess = el.querySelector('.file-access-control'); |
291 fileAccess.addEventListener('click', function(e) { | 294 fileAccess.addEventListener('click', function(e) { |
292 chrome.developerPrivate.allowFileAccess( | 295 chrome.developerPrivate.allowFileAccess( |
293 item.id, !!e.target.checked, function(result) { | 296 item.id, !!e.target.checked, function(result) { |
| 297 ItemsList.loadItemsInfo(); |
294 }); | 298 }); |
295 }); | 299 }); |
296 fileAccess.querySelector('input').checked = item.allow_file_access; | 300 fileAccess.querySelector('input').checked = item.allow_file_access; |
297 fileAccess.hidden = false; | 301 fileAccess.hidden = false; |
298 }, | 302 }, |
299 | 303 |
300 /** | 304 /** |
| 305 * Sets the handler for the allow_incognito checkbox. |
| 306 * @param {!Object} item A dictionary of item metadata. |
| 307 * @param {HTMLElement} el HTML element containing all items. |
| 308 * @private |
| 309 */ |
| 310 setAllowIncognitoCheckbox_: function(item, el) { |
| 311 if (item.allow_incognito) { |
| 312 var incognito = el.querySelector('.incognito-control'); |
| 313 incognito.addEventListener('change', function(e) { |
| 314 chrome.developerPrivate.allowIncognito( |
| 315 item.id, !!e.target.checked, function() { |
| 316 ItemsList.loadItemsInfo(); |
| 317 }); |
| 318 }); |
| 319 incognito.querySelector('input').checked = item.incognito_enabled; |
| 320 incognito.hidden = false; |
| 321 } |
| 322 }, |
| 323 |
| 324 /** |
301 * Sets the active views link of an item. Clicking on the link | 325 * Sets the active views link of an item. Clicking on the link |
302 * opens devtools window to inspect. | 326 * opens devtools window to inspect. |
303 * @param {!Object} item A dictionary of item metadata. | 327 * @param {!Object} item A dictionary of item metadata. |
304 * @param {HTMLElement} el HTML element containing all items. | 328 * @param {HTMLElement} el HTML element containing all items. |
305 * @private | 329 * @private |
306 */ | 330 */ |
307 setActiveViews_: function(item, el) { | 331 setActiveViews_: function(item, el) { |
308 if (!item.views.length) | 332 if (!item.views.length) |
309 return; | 333 return; |
310 | 334 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 */ | 386 */ |
363 ItemsList.launchApp = function(id) { | 387 ItemsList.launchApp = function(id) { |
364 chrome.management.launchApp(id); | 388 chrome.management.launchApp(id); |
365 ItemsList.loadItemsInfo(); | 389 ItemsList.loadItemsInfo(); |
366 }; | 390 }; |
367 | 391 |
368 return { | 392 return { |
369 ItemsList: ItemsList, | 393 ItemsList: ItemsList, |
370 }; | 394 }; |
371 }); | 395 }); |
OLD | NEW |