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="../uber/uber_utils.js"> | 5 <include src="../uber/uber_utils.js"> |
6 <include src="extension_code.js"> | 6 <include src="extension_code.js"> |
7 <include src="extension_commands_overlay.js"> | 7 <include src="extension_commands_overlay.js"> |
8 <include src="extension_focus_manager.js"> | 8 <include src="extension_focus_manager.js"> |
9 <include src="extension_list.js"> | 9 <include src="extension_list.js"> |
10 <include src="pack_extension_overlay.js"> | 10 <include src="pack_extension_overlay.js"> |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 return x < y ? -1 : (x > y ? 1 : 0); | 296 return x < y ? -1 : (x > y ? 1 : 0); |
297 } | 297 } |
298 return compare(a.order, b.order) || | 298 return compare(a.order, b.order) || |
299 compare(a.name.toLowerCase(), b.name.toLowerCase()) || | 299 compare(a.name.toLowerCase(), b.name.toLowerCase()) || |
300 compare(a.id, b.id); | 300 compare(a.id, b.id); |
301 }); | 301 }); |
302 } | 302 } |
303 | 303 |
304 var pageDiv = $('extension-settings'); | 304 var pageDiv = $('extension-settings'); |
305 var marginTop = 0; | 305 var marginTop = 0; |
306 if (extensionsData.profileIsManaged) { | 306 if (extensionsData.profileIsSupervised) { |
307 pageDiv.classList.add('profile-is-managed'); | 307 pageDiv.classList.add('profile-is-supervised'); |
308 } else { | 308 } else { |
309 pageDiv.classList.remove('profile-is-managed'); | 309 pageDiv.classList.remove('profile-is-supervised'); |
310 } | 310 } |
311 if (extensionsData.profileIsManaged) { | 311 if (extensionsData.profileIsSupervised) { |
312 pageDiv.classList.add('showing-banner'); | 312 pageDiv.classList.add('showing-banner'); |
313 $('toggle-dev-on').disabled = true; | 313 $('toggle-dev-on').disabled = true; |
314 marginTop += 45; | 314 marginTop += 45; |
315 } else { | 315 } else { |
316 pageDiv.classList.remove('showing-banner'); | 316 pageDiv.classList.remove('showing-banner'); |
317 $('toggle-dev-on').disabled = false; | 317 $('toggle-dev-on').disabled = false; |
318 } | 318 } |
319 | 319 |
320 pageDiv.style.marginTop = marginTop + 'px'; | 320 pageDiv.style.marginTop = marginTop + 'px'; |
321 | 321 |
322 if (extensionsData.developerMode) { | 322 if (extensionsData.developerMode) { |
323 pageDiv.classList.add('dev-mode'); | 323 pageDiv.classList.add('dev-mode'); |
324 $('toggle-dev-on').checked = true; | 324 $('toggle-dev-on').checked = true; |
325 $('dev-controls').hidden = false; | 325 $('dev-controls').hidden = false; |
326 } else { | 326 } else { |
327 pageDiv.classList.remove('dev-mode'); | 327 pageDiv.classList.remove('dev-mode'); |
328 $('toggle-dev-on').checked = false; | 328 $('toggle-dev-on').checked = false; |
329 } | 329 } |
330 | 330 |
331 ExtensionSettings.getInstance().displayPromo_ = | 331 ExtensionSettings.getInstance().displayPromo_ = |
332 extensionsData.promoteAppsDevTools; | 332 extensionsData.promoteAppsDevTools; |
333 ExtensionSettings.getInstance().updatePromoVisibility_(); | 333 ExtensionSettings.getInstance().updatePromoVisibility_(); |
334 | 334 |
335 $('load-unpacked').disabled = extensionsData.loadUnpackedDisabled; | 335 $('load-unpacked').disabled = extensionsData.loadUnpackedDisabled; |
336 | 336 |
337 ExtensionsList.prototype.data_ = extensionsData; | 337 ExtensionsList.prototype.data_ = extensionsData; |
338 var extensionList = $('extension-settings-list'); | 338 var extensionList = $('extension-settings-list'); |
339 ExtensionsList.decorate(extensionList); | 339 ExtensionsList.decorate(extensionList); |
340 } | 340 }; |
341 | 341 |
342 // Indicate that warning |message| has occured for pack of |crx_path| and | 342 // Indicate that warning |message| has occured for pack of |crx_path| and |
343 // |pem_path| files. Ask if user wants override the warning. Send | 343 // |pem_path| files. Ask if user wants override the warning. Send |
344 // |overrideFlags| to repeated 'pack' call to accomplish the override. | 344 // |overrideFlags| to repeated 'pack' call to accomplish the override. |
345 ExtensionSettings.askToOverrideWarning = | 345 ExtensionSettings.askToOverrideWarning = |
346 function(message, crx_path, pem_path, overrideFlags) { | 346 function(message, crx_path, pem_path, overrideFlags) { |
347 var closeAlert = function() { | 347 var closeAlert = function() { |
348 ExtensionSettings.showOverlay(null); | 348 ExtensionSettings.showOverlay(null); |
349 }; | 349 }; |
350 | 350 |
351 alertOverlay.setValues( | 351 alertOverlay.setValues( |
352 loadTimeData.getString('packExtensionWarningTitle'), | 352 loadTimeData.getString('packExtensionWarningTitle'), |
353 message, | 353 message, |
354 loadTimeData.getString('packExtensionProceedAnyway'), | 354 loadTimeData.getString('packExtensionProceedAnyway'), |
355 loadTimeData.getString('cancel'), | 355 loadTimeData.getString('cancel'), |
356 function() { | 356 function() { |
357 chrome.send('pack', [crx_path, pem_path, overrideFlags]); | 357 chrome.send('pack', [crx_path, pem_path, overrideFlags]); |
358 closeAlert(); | 358 closeAlert(); |
359 }, | 359 }, |
360 closeAlert); | 360 closeAlert); |
361 ExtensionSettings.showOverlay($('alertOverlay')); | 361 ExtensionSettings.showOverlay($('alertOverlay')); |
362 } | 362 }; |
363 | 363 |
364 /** | 364 /** |
365 * Returns the current overlay or null if one does not exist. | 365 * Returns the current overlay or null if one does not exist. |
366 * @return {Element} The overlay element. | 366 * @return {Element} The overlay element. |
367 */ | 367 */ |
368 ExtensionSettings.getCurrentOverlay = function() { | 368 ExtensionSettings.getCurrentOverlay = function() { |
369 return document.querySelector('#overlay .page.showing'); | 369 return document.querySelector('#overlay .page.showing'); |
370 } | 370 }; |
371 | 371 |
372 /** | 372 /** |
373 * Sets the given overlay to show. This hides whatever overlay is currently | 373 * Sets the given overlay to show. This hides whatever overlay is currently |
374 * showing, if any. | 374 * showing, if any. |
375 * @param {HTMLElement} node The overlay page to show. If falsey, all overlays | 375 * @param {HTMLElement} node The overlay page to show. If falsey, all overlays |
376 * are hidden. | 376 * are hidden. |
377 */ | 377 */ |
378 ExtensionSettings.showOverlay = function(node) { | 378 ExtensionSettings.showOverlay = function(node) { |
379 var pageDiv = $('extension-settings'); | 379 var pageDiv = $('extension-settings'); |
380 if (node) { | 380 if (node) { |
(...skipping 12 matching lines...) Expand all Loading... |
393 node.classList.add('showing'); | 393 node.classList.add('showing'); |
394 | 394 |
395 var pages = document.querySelectorAll('.page'); | 395 var pages = document.querySelectorAll('.page'); |
396 for (var i = 0; i < pages.length; i++) { | 396 for (var i = 0; i < pages.length; i++) { |
397 pages[i].setAttribute('aria-hidden', node ? 'true' : 'false'); | 397 pages[i].setAttribute('aria-hidden', node ? 'true' : 'false'); |
398 } | 398 } |
399 | 399 |
400 overlay.hidden = !node; | 400 overlay.hidden = !node; |
401 uber.invokeMethodOnParent(node ? 'beginInterceptingEvents' : | 401 uber.invokeMethodOnParent(node ? 'beginInterceptingEvents' : |
402 'stopInterceptingEvents'); | 402 'stopInterceptingEvents'); |
403 } | 403 }; |
404 | 404 |
405 /** | 405 /** |
406 * Utility function to find the width of various UI strings and synchronize | 406 * Utility function to find the width of various UI strings and synchronize |
407 * the width of relevant spans. This is crucial for making sure the | 407 * the width of relevant spans. This is crucial for making sure the |
408 * Enable/Enabled checkboxes align, as well as the Developer Mode checkbox. | 408 * Enable/Enabled checkboxes align, as well as the Developer Mode checkbox. |
409 */ | 409 */ |
410 function measureCheckboxStrings() { | 410 function measureCheckboxStrings() { |
411 var trashWidth = 30; | 411 var trashWidth = 30; |
412 var measuringDiv = $('font-measuring-div'); | 412 var measuringDiv = $('font-measuring-div'); |
413 measuringDiv.textContent = | 413 measuringDiv.textContent = |
(...skipping 20 matching lines...) Expand all Loading... |
434 | 434 |
435 // Export | 435 // Export |
436 return { | 436 return { |
437 ExtensionSettings: ExtensionSettings | 437 ExtensionSettings: ExtensionSettings |
438 }; | 438 }; |
439 }); | 439 }); |
440 | 440 |
441 window.addEventListener('load', function(e) { | 441 window.addEventListener('load', function(e) { |
442 extensions.ExtensionSettings.getInstance().initialize(); | 442 extensions.ExtensionSettings.getInstance().initialize(); |
443 }); | 443 }); |
OLD | NEW |