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

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

Issue 900623003: extensions: focus options overlay content when shown. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@policy-icon-label
Patch Set: reverting cruft Created 5 years, 10 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
« no previous file with comments | « no previous file | chrome/browser/resources/extensions/extension_options_overlay.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 * 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
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;
Dan Beam 2015/02/03 17:38:47 this is better than .bind() in this case (IMO) as
587
588 $('overlay').addEventListener('animationFinished', function f() {
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 });
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/extensions/extension_options_overlay.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698