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="../../../../ui/webui/resources/js/cr/ui/focus_row.js"> | 5 // <include src="../../../../ui/webui/resources/js/cr/ui/focus_row.js"> |
6 // <include src="../../../../ui/webui/resources/js/cr/ui/focus_grid.js"> | 6 // <include src="../../../../ui/webui/resources/js/cr/ui/focus_grid.js"> |
7 // <include src="../uber/uber_utils.js"> | |
8 // <include src="drag_and_drop_handler.js"> | 7 // <include src="drag_and_drop_handler.js"> |
9 // <include src="extension_code.js"> | 8 // <include src="extension_code.js"> |
10 // <include src="extension_commands_overlay.js"> | 9 // <include src="extension_commands_overlay.js"> |
11 // <include src="extension_error_overlay.js"> | 10 // <include src="extension_error_overlay.js"> |
12 // <include src="extension_focus_manager.js"> | 11 // <include src="extension_focus_manager.js"> |
13 // <include src="focus_row.js"> | 12 // <include src="focus_row.js"> |
14 // <include src="extension_list.js"> | 13 // <include src="extension_list.js"> |
15 // <include src="pack_extension_overlay.js"> | 14 // <include src="pack_extension_overlay.js"> |
16 // <include src="extension_loader.js"> | 15 // <include src="extension_loader.js"> |
17 // <include src="extension_options_overlay.js"> | 16 // <include src="extension_options_overlay.js"> |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 * True if the page has finished the initial load. | 57 * True if the page has finished the initial load. |
59 * @private {boolean} | 58 * @private {boolean} |
60 */ | 59 */ |
61 hasLoaded_: false, | 60 hasLoaded_: false, |
62 | 61 |
63 /** | 62 /** |
64 * Perform initial setup. | 63 * Perform initial setup. |
65 */ | 64 */ |
66 initialize: function() { | 65 initialize: function() { |
67 this.setLoading_(true); | 66 this.setLoading_(true); |
68 uber.onContentFrameLoaded(); | |
69 cr.ui.FocusOutlineManager.forDocument(document); | 67 cr.ui.FocusOutlineManager.forDocument(document); |
70 measureCheckboxStrings(); | 68 measureCheckboxStrings(); |
71 | 69 |
72 // Set the title. | |
73 uber.setTitle(loadTimeData.getString('extensionSettings')); | |
74 | |
75 var extensionList = new ExtensionList(this); | 70 var extensionList = new ExtensionList(this); |
76 extensionList.id = 'extension-settings-list'; | 71 extensionList.id = 'extension-settings-list'; |
77 var wrapper = $('extension-list-wrapper'); | 72 var wrapper = $('extension-list-wrapper'); |
78 wrapper.insertBefore(extensionList, wrapper.firstChild); | 73 wrapper.insertBefore(extensionList, wrapper.firstChild); |
79 | 74 |
80 // Get the initial profile state, and register to be notified of any | 75 // Get the initial profile state, and register to be notified of any |
81 // future changes. | 76 // future changes. |
82 chrome.developerPrivate.getProfileConfiguration( | 77 chrome.developerPrivate.getProfileConfiguration( |
83 this.update_.bind(this)); | 78 this.update_.bind(this)); |
84 chrome.developerPrivate.onProfileStateChanged.addListener( | 79 chrome.developerPrivate.onProfileStateChanged.addListener( |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 | 373 |
379 var focusOutlineManager = cr.ui.FocusOutlineManager.forDocument(document); | 374 var focusOutlineManager = cr.ui.FocusOutlineManager.forDocument(document); |
380 if (focusOutlineManager.visible) | 375 if (focusOutlineManager.visible) |
381 lastFocused = document.activeElement; | 376 lastFocused = document.activeElement; |
382 | 377 |
383 $('overlay').addEventListener('cancelOverlay', function f() { | 378 $('overlay').addEventListener('cancelOverlay', function f() { |
384 if (lastFocused && focusOutlineManager.visible) | 379 if (lastFocused && focusOutlineManager.visible) |
385 lastFocused.focus(); | 380 lastFocused.focus(); |
386 | 381 |
387 $('overlay').removeEventListener('cancelOverlay', f); | 382 $('overlay').removeEventListener('cancelOverlay', f); |
388 uber.replaceState({}, ''); | 383 window.history.replaceState({}, '', '/'); |
389 }); | 384 }); |
390 node.classList.add('showing'); | 385 node.classList.add('showing'); |
391 } | 386 } |
392 | 387 |
393 var pages = document.querySelectorAll('.page'); | 388 var pages = document.querySelectorAll('.page'); |
394 for (var i = 0; i < pages.length; i++) { | 389 for (var i = 0; i < pages.length; i++) { |
395 var hidden = (node != pages[i]) ? 'true' : 'false'; | 390 var hidden = (node != pages[i]) ? 'true' : 'false'; |
396 pages[i].setAttribute('aria-hidden', hidden); | 391 pages[i].setAttribute('aria-hidden', hidden); |
397 } | 392 } |
398 | 393 |
399 $('overlay').hidden = !node; | 394 $('overlay').hidden = !node; |
400 | 395 |
401 if (node) | 396 if (node) |
402 ExtensionSettings.focusOverlay(); | 397 ExtensionSettings.focusOverlay(); |
403 | 398 |
404 // If drag-drop for external Extension installation is available, enable | 399 // If drag-drop for external Extension installation is available, enable |
405 // drag-drop when there is any overlay showing other than the usual overlay | 400 // drag-drop when there is any overlay showing other than the usual overlay |
406 // shown when drag-drop is started. | 401 // shown when drag-drop is started. |
407 var settings = ExtensionSettings.getInstance(); | 402 var settings = ExtensionSettings.getInstance(); |
408 if (settings.dragWrapper_) { | 403 if (settings.dragWrapper_) { |
409 assert(settings.dragWrapperHandler_).dragEnabled = | 404 assert(settings.dragWrapperHandler_).dragEnabled = |
410 !node || node == $('drop-target-overlay'); | 405 !node || node == $('drop-target-overlay'); |
411 } | 406 } |
412 | |
413 uber.invokeMethodOnParent(node ? 'beginInterceptingEvents' : | |
414 'stopInterceptingEvents'); | |
415 }; | 407 }; |
416 | 408 |
417 ExtensionSettings.focusOverlay = function() { | 409 ExtensionSettings.focusOverlay = function() { |
418 var currentlyShowingOverlay = ExtensionSettings.getCurrentOverlay(); | 410 var currentlyShowingOverlay = ExtensionSettings.getCurrentOverlay(); |
419 assert(currentlyShowingOverlay); | 411 assert(currentlyShowingOverlay); |
420 | 412 |
421 if (cr.ui.FocusOutlineManager.forDocument(document).visible) | 413 if (cr.ui.FocusOutlineManager.forDocument(document).visible) |
422 cr.ui.setInitialFocus(currentlyShowingOverlay); | 414 cr.ui.setInitialFocus(currentlyShowingOverlay); |
423 | 415 |
424 if (!currentlyShowingOverlay.contains(document.activeElement)) { | 416 if (!currentlyShowingOverlay.contains(document.activeElement)) { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 | 454 |
463 // Export | 455 // Export |
464 return { | 456 return { |
465 ExtensionSettings: ExtensionSettings | 457 ExtensionSettings: ExtensionSettings |
466 }; | 458 }; |
467 }); | 459 }); |
468 | 460 |
469 window.addEventListener('load', function(e) { | 461 window.addEventListener('load', function(e) { |
470 extensions.ExtensionSettings.getInstance().initialize(); | 462 extensions.ExtensionSettings.getInstance().initialize(); |
471 }); | 463 }); |
OLD | NEW |