Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(142)

Side by Side Diff: chrome/browser/resources/extensions/extension_list.js

Issue 997183005: [Extensions] Add a developerPrivate.updateExtensionConfiguration function (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Ben's Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 var template = $('template-collection').querySelector( 304 var template = $('template-collection').querySelector(
305 '.extension-list-item-wrapper'); 305 '.extension-list-item-wrapper');
306 var node = template.cloneNode(true); 306 var node = template.cloneNode(true);
307 ExtensionFocusRow.decorate(node, $('extension-settings-list')); 307 ExtensionFocusRow.decorate(node, $('extension-settings-list'));
308 308
309 var row = assertInstanceof(node, ExtensionFocusRow); 309 var row = assertInstanceof(node, ExtensionFocusRow);
310 row.id = extension.id; 310 row.id = extension.id;
311 311
312 // The 'Show Browser Action' button. 312 // The 'Show Browser Action' button.
313 row.setupColumn('.show-button', 'showButton', 'click', function(e) { 313 row.setupColumn('.show-button', 'showButton', 'click', function(e) {
314 chrome.send('extensionSettingsShowButton', [extension.id]); 314 chrome.developerPrivate.updateExtensionConfiguration({
315 extensionId: extension.id,
316 showActionButton: true
317 });
315 }); 318 });
316 319
317 // The 'allow in incognito' checkbox. 320 // The 'allow in incognito' checkbox.
318 row.setupColumn('.incognito-control input', 'incognito', 'change', 321 row.setupColumn('.incognito-control input', 'incognito', 'change',
319 function(e) { 322 function(e) {
320 var butterBar = row.querySelector('.butter-bar'); 323 var butterBar = row.querySelector('.butter-bar');
321 var checked = e.target.checked; 324 var checked = e.target.checked;
322 if (!this.butterbarShown_) { 325 if (!this.butterbarShown_) {
323 butterBar.hidden = !checked || 326 butterBar.hidden = !checked ||
324 extension.type == 327 extension.type ==
325 chrome.developerPrivate.ExtensionType.HOSTED_APP; 328 chrome.developerPrivate.ExtensionType.HOSTED_APP;
326 this.butterbarShown_ = !butterBar.hidden; 329 this.butterbarShown_ = !butterBar.hidden;
327 } else { 330 } else {
328 butterBar.hidden = true; 331 butterBar.hidden = true;
329 } 332 }
330 chrome.developerPrivate.allowIncognito(extension.id, checked); 333 chrome.developerPrivate.updateExtensionConfiguration({
334 extensionId: extension.id,
335 incognitoAccess: e.target.checked
336 });
331 }.bind(this)); 337 }.bind(this));
332 338
333 // The 'collect errors' checkbox. This should only be visible if the 339 // The 'collect errors' checkbox. This should only be visible if the
334 // error console is enabled - we can detect this by the existence of the 340 // error console is enabled - we can detect this by the existence of the
335 // |errorCollectionEnabled| property. 341 // |errorCollectionEnabled| property.
336 row.setupColumn('.error-collection-control input', 'dev-collectErrors', 342 row.setupColumn('.error-collection-control input', 'dev-collectErrors',
337 'change', function(e) { 343 'change', function(e) {
338 chrome.send('extensionSettingsEnableErrorCollection', 344 chrome.developerPrivate.updateExtensionConfiguration({
339 [extension.id, String(e.target.checked)]); 345 extensionId: extension.id,
346 errorCollection: e.target.checked
347 });
340 }); 348 });
341 349
342 // The 'allow on all urls' checkbox. This should only be visible if 350 // The 'allow on all urls' checkbox. This should only be visible if
343 // active script restrictions are enabled. If they are not enabled, no 351 // active script restrictions are enabled. If they are not enabled, no
344 // extensions should want all urls. 352 // extensions should want all urls.
345 row.setupColumn('.all-urls-control input', 'allUrls', 'click', 353 row.setupColumn('.all-urls-control input', 'allUrls', 'click',
346 function(e) { 354 function(e) {
347 chrome.send('extensionSettingsAllowOnAllUrls', 355 chrome.developerPrivate.updateExtensionConfiguration({
348 [extension.id, String(e.target.checked)]); 356 extensionId: extension.id,
357 runOnAllUrls: e.target.checked
358 });
349 }); 359 });
350 360
351 // The 'allow file:// access' checkbox. 361 // The 'allow file:// access' checkbox.
352 row.setupColumn('.file-access-control input', 'localUrls', 'click', 362 row.setupColumn('.file-access-control input', 'localUrls', 'click',
353 function(e) { 363 function(e) {
354 chrome.developerPrivate.allowFileAccess(extension.id, e.target.checked); 364 chrome.developerPrivate.updateExtensionConfiguration({
365 extensionId: extension.id,
366 fileAccess: e.target.checked
367 });
355 }); 368 });
356 369
357 // The 'Options' button or link, depending on its behaviour. 370 // The 'Options' button or link, depending on its behaviour.
358 // Set an href to get the correct mouse-over appearance (link, 371 // Set an href to get the correct mouse-over appearance (link,
359 // footer) - but the actual link opening is done through chrome.send 372 // footer) - but the actual link opening is done through chrome.send
360 // with a preventDefault(). 373 // with a preventDefault().
361 row.querySelector('.options-link').href = 374 row.querySelector('.options-link').href =
362 extension.optionsPage ? extension.optionsPage.url : ''; 375 extension.optionsPage ? extension.optionsPage.url : '';
363 row.setupColumn('.options-link', 'options', 'click', function(e) { 376 row.setupColumn('.options-link', 'options', 'click', function(e) {
364 chrome.send('extensionSettingsOptions', [extension.id]); 377 chrome.send('extensionSettingsOptions', [extension.id]);
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
903 // TODO(dbeam): why do we need to focus <extensionoptions> before and 916 // TODO(dbeam): why do we need to focus <extensionoptions> before and
904 // after its showing animation? Makes very little sense to me. 917 // after its showing animation? Makes very little sense to me.
905 overlay.setInitialFocus(); 918 overlay.setInitialFocus();
906 }, 919 },
907 }; 920 };
908 921
909 return { 922 return {
910 ExtensionList: ExtensionList 923 ExtensionList: ExtensionList
911 }; 924 };
912 }); 925 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698