| 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 <include src="extension_error.js"> | 5 <include src="extension_error.js"> |
| 6 | 6 |
| 7 /////////////////////////////////////////////////////////////////////////////// | 7 /////////////////////////////////////////////////////////////////////////////// |
| 8 // ExtensionFocusRow: | 8 // ExtensionFocusRow: |
| 9 | 9 |
| 10 /** | 10 /** |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 var template = $('template-collection').querySelector( | 309 var template = $('template-collection').querySelector( |
| 310 '.extension-list-item-wrapper'); | 310 '.extension-list-item-wrapper'); |
| 311 var node = template.cloneNode(true); | 311 var node = template.cloneNode(true); |
| 312 ExtensionFocusRow.decorate(node, $('extension-settings-list')); | 312 ExtensionFocusRow.decorate(node, $('extension-settings-list')); |
| 313 | 313 |
| 314 var row = assertInstanceof(node, ExtensionFocusRow); | 314 var row = assertInstanceof(node, ExtensionFocusRow); |
| 315 row.id = extension.id; | 315 row.id = extension.id; |
| 316 | 316 |
| 317 // The 'Show Browser Action' button. | 317 // The 'Show Browser Action' button. |
| 318 row.setupColumn('.show-button', 'showButton', 'click', function(e) { | 318 row.setupColumn('.show-button', 'showButton', 'click', function(e) { |
| 319 chrome.send('extensionSettingsShowButton', [extension.id]); | 319 chrome.developerPrivate.updateExtensionConfiguration({ |
| 320 extensionId: extension.id, |
| 321 showActionButton: true |
| 322 }); |
| 320 }); | 323 }); |
| 321 | 324 |
| 322 // The 'allow in incognito' checkbox. | 325 // The 'allow in incognito' checkbox. |
| 323 row.setupColumn('.incognito-control input', 'incognito', 'change', | 326 row.setupColumn('.incognito-control input', 'incognito', 'change', |
| 324 function(e) { | 327 function(e) { |
| 325 var butterBar = row.querySelector('.butter-bar'); | 328 var butterBar = row.querySelector('.butter-bar'); |
| 326 var checked = e.target.checked; | 329 var checked = e.target.checked; |
| 327 if (!this.butterbarShown_) { | 330 if (!this.butterbarShown_) { |
| 328 butterBar.hidden = !checked || | 331 butterBar.hidden = !checked || |
| 329 extension.type == | 332 extension.type == |
| 330 chrome.developerPrivate.ExtensionType.HOSTED_APP; | 333 chrome.developerPrivate.ExtensionType.HOSTED_APP; |
| 331 this.butterbarShown_ = !butterBar.hidden; | 334 this.butterbarShown_ = !butterBar.hidden; |
| 332 } else { | 335 } else { |
| 333 butterBar.hidden = true; | 336 butterBar.hidden = true; |
| 334 } | 337 } |
| 335 chrome.developerPrivate.allowIncognito(extension.id, checked); | 338 chrome.developerPrivate.updateExtensionConfiguration({ |
| 339 extensionId: extension.id, |
| 340 incognitoAccess: e.target.checked |
| 341 }); |
| 336 }.bind(this)); | 342 }.bind(this)); |
| 337 | 343 |
| 338 // The 'collect errors' checkbox. This should only be visible if the | 344 // The 'collect errors' checkbox. This should only be visible if the |
| 339 // error console is enabled - we can detect this by the existence of the | 345 // error console is enabled - we can detect this by the existence of the |
| 340 // |errorCollectionEnabled| property. | 346 // |errorCollectionEnabled| property. |
| 341 row.setupColumn('.error-collection-control input', 'dev-collectErrors', | 347 row.setupColumn('.error-collection-control input', 'dev-collectErrors', |
| 342 'change', function(e) { | 348 'change', function(e) { |
| 343 chrome.send('extensionSettingsEnableErrorCollection', | 349 chrome.developerPrivate.updateExtensionConfiguration({ |
| 344 [extension.id, String(e.target.checked)]); | 350 extensionId: extension.id, |
| 351 errorCollection: e.target.checked |
| 352 }); |
| 345 }); | 353 }); |
| 346 | 354 |
| 347 // The 'allow on all urls' checkbox. This should only be visible if | 355 // The 'allow on all urls' checkbox. This should only be visible if |
| 348 // active script restrictions are enabled. If they are not enabled, no | 356 // active script restrictions are enabled. If they are not enabled, no |
| 349 // extensions should want all urls. | 357 // extensions should want all urls. |
| 350 row.setupColumn('.all-urls-control input', 'allUrls', 'click', | 358 row.setupColumn('.all-urls-control input', 'allUrls', 'click', |
| 351 function(e) { | 359 function(e) { |
| 352 chrome.send('extensionSettingsAllowOnAllUrls', | 360 chrome.developerPrivate.updateExtensionConfiguration({ |
| 353 [extension.id, String(e.target.checked)]); | 361 extensionId: extension.id, |
| 362 runOnAllUrls: e.target.checked |
| 363 }); |
| 354 }); | 364 }); |
| 355 | 365 |
| 356 // The 'allow file:// access' checkbox. | 366 // The 'allow file:// access' checkbox. |
| 357 row.setupColumn('.file-access-control input', 'localUrls', 'click', | 367 row.setupColumn('.file-access-control input', 'localUrls', 'click', |
| 358 function(e) { | 368 function(e) { |
| 359 chrome.developerPrivate.allowFileAccess(extension.id, e.target.checked); | 369 chrome.developerPrivate.updateExtensionConfiguration({ |
| 370 extensionId: extension.id, |
| 371 fileAccess: e.target.checked |
| 372 }); |
| 360 }); | 373 }); |
| 361 | 374 |
| 362 // The 'Options' button or link, depending on its behaviour. | 375 // The 'Options' button or link, depending on its behaviour. |
| 363 // Set an href to get the correct mouse-over appearance (link, | 376 // Set an href to get the correct mouse-over appearance (link, |
| 364 // footer) - but the actual link opening is done through chrome.send | 377 // footer) - but the actual link opening is done through chrome.send |
| 365 // with a preventDefault(). | 378 // with a preventDefault(). |
| 366 row.querySelector('.options-link').href = | 379 row.querySelector('.options-link').href = |
| 367 extension.optionsPage ? extension.optionsPage.url : ''; | 380 extension.optionsPage ? extension.optionsPage.url : ''; |
| 368 row.setupColumn('.options-link', 'options', 'click', function(e) { | 381 row.setupColumn('.options-link', 'options', 'click', function(e) { |
| 369 chrome.send('extensionSettingsOptions', [extension.id]); | 382 chrome.send('extensionSettingsOptions', [extension.id]); |
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 914 // TODO(dbeam): why do we need to focus <extensionoptions> before and | 927 // TODO(dbeam): why do we need to focus <extensionoptions> before and |
| 915 // after its showing animation? Makes very little sense to me. | 928 // after its showing animation? Makes very little sense to me. |
| 916 overlay.setInitialFocus(); | 929 overlay.setInitialFocus(); |
| 917 }, | 930 }, |
| 918 }; | 931 }; |
| 919 | 932 |
| 920 return { | 933 return { |
| 921 ExtensionList: ExtensionList | 934 ExtensionList: ExtensionList |
| 922 }; | 935 }; |
| 923 }); | 936 }); |
| OLD | NEW |