| 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 |
| 571 document.activeElement.blur(); |
| 572 |
| 570 // Add the options query string. Corner case: the 'options' query string | 573 // 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 | 574 // 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. | 575 // 'id' is in the URL, or if both query strings are in the URL. |
| 573 uber.replaceState({}, '?options=' + extensionId); | 576 uber.replaceState({}, '?options=' + extensionId); |
| 574 | 577 |
| 575 extensions.ExtensionOptionsOverlay.getInstance(). | 578 var shownCallback = function() { |
| 576 setExtensionAndShowOverlay(extensionId, | 579 if (cr.ui.FocusOutlineManager.forDocument(document).visible) |
| 577 extension.name, | 580 overlay.setInitialFocus(); |
| 578 extension.icon); | 581 }; |
| 579 | 582 |
| 583 var overlay = extensions.ExtensionOptionsOverlay.getInstance(); |
| 584 overlay.setExtensionAndShowOverlay(extensionId, extension.name, |
| 585 extension.icon, shownCallback); |
| 580 this.optionsShown_ = true; | 586 this.optionsShown_ = true; |
| 581 $('overlay').addEventListener('cancelOverlay', function() { | 587 |
| 582 this.optionsShown_ = false; | 588 var self = this; |
| 583 }.bind(this)); | 589 $('overlay').addEventListener('cancelOverlay', function f() { |
| 590 // Restore focus instead of just blurring when this page isn't rebuild |
| 591 // crazy. http://crbug.com/450818 |
| 592 document.activeElement.blur(); |
| 593 self.optionsShown_ = false; |
| 594 $('overlay').removeEventListener('cancelOverlay', f); |
| 595 }); |
| 596 |
| 597 // TODO(dbeam): guestview's focus is weird. Only when this is called from |
| 598 // within this event handler *and* after the showing animation completes |
| 599 // does this work. |
| 600 shownCallback(); |
| 584 }, | 601 }, |
| 585 }; | 602 }; |
| 586 | 603 |
| 587 return { | 604 return { |
| 588 ExtensionsList: ExtensionsList | 605 ExtensionsList: ExtensionsList |
| 589 }; | 606 }; |
| 590 }); | 607 }); |
| OLD | NEW |