Chromium Code Reviews| 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 * The type of the extension data object. The definition is based on | 8 * The type of the extension data object. The definition is based on |
| 9 * chrome/browser/ui/webui/extensions/extension_basic_info.cc | 9 * chrome/browser/ui/webui/extensions/extension_basic_info.cc |
| 10 * and | 10 * and |
| (...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 560 // Get the extension from the given id. | 560 // Get the extension from the given id. |
| 561 var extension = this.data_.extensions.filter(function(extension) { | 561 var extension = this.data_.extensions.filter(function(extension) { |
| 562 return extension.enabled && extension.id == extensionId; | 562 return extension.enabled && extension.id == extensionId; |
| 563 })[0]; | 563 })[0]; |
| 564 | 564 |
| 565 if (!extension) | 565 if (!extension) |
| 566 return; | 566 return; |
| 567 | 567 |
| 568 if (scroll) | 568 if (scroll) |
| 569 this.scrollToNode_(extensionId); | 569 this.scrollToNode_(extensionId); |
| 570 | |
| 570 // Add the options query string. Corner case: the 'options' query string | 571 // Add the options query string. Corner case: the 'options' query string |
| 571 // will clobber the 'id' query string if the options link is clicked when | 572 // will clobber the 'id' query string if the options link is clicked when |
| 572 // 'id' is in the URL, or if both query strings are in the URL. | 573 // 'id' is in the URL, or if both query strings are in the URL. |
| 573 uber.replaceState({}, '?options=' + extensionId); | 574 uber.replaceState({}, '?options=' + extensionId); |
| 574 | 575 |
| 575 extensions.ExtensionOptionsOverlay.getInstance(). | 576 var overlay = extensions.ExtensionOptionsOverlay.getInstance(); |
| 576 setExtensionAndShowOverlay(extensionId, | 577 overlay.setExtensionAndShowOverlay(extensionId, extension.name, |
| 577 extension.name, | 578 extension.icon); |
| 578 extension.icon); | 579 this.optionsShown_ = true; |
| 579 | 580 |
| 580 this.optionsShown_ = true; | 581 if (cr.ui.FocusOutlineManager.forDocument(document).visible) |
| 581 $('overlay').addEventListener('cancelOverlay', function() { | 582 overlay.setInitialFocus(); |
| 582 this.optionsShown_ = false; | 583 else |
| 583 }.bind(this)); | 584 document.activeElement.blur(); |
| 585 | |
| 586 var self = this; | |
| 587 | |
| 588 $('overlay').addEventListener('animationFinished', function f() { | |
|
not at google - send to devlin
2015/02/03 20:52:04
Consider commenting that the animation is started
Dan Beam
2015/02/04 17:15:38
Done.
| |
| 589 overlay.setInitialFocus(); | |
| 590 $('overlay').removeEventListener('animationFinished', f); | |
| 591 }); | |
| 592 | |
| 593 $('overlay').addEventListener('cancelOverlay', function f() { | |
| 594 // Restore initial focus once this page isn't rebuild crazy. | |
| 595 // http://crbug.com/450818 | |
| 596 self.optionsShown_ = false; | |
| 597 $('overlay').removeEventListener('cancelOverlay', f); | |
| 598 }); | |
| 584 }, | 599 }, |
| 585 }; | 600 }; |
| 586 | 601 |
| 587 return { | 602 return { |
| 588 ExtensionsList: ExtensionsList | 603 ExtensionsList: ExtensionsList |
| 589 }; | 604 }; |
| 590 }); | 605 }); |
| OLD | NEW |