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

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: fixes 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
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 initial focus once this page isn't rebuild crazy.
591 // http://crbug.com/450818
592 self.optionsShown_ = false;
593 $('overlay').removeEventListener('cancelOverlay', f);
594 });
595
596 // TODO(dbeam): guestview's focus is weird. Only when this is called from
597 // within this event handler *and* after the showing animation completes
598 // does this work.
599 shownCallback();
Dan Beam 2015/02/04 18:11:21 kalman@: ok with this?
584 }, 600 },
585 }; 601 };
586 602
587 return { 603 return {
588 ExtensionsList: ExtensionsList 604 ExtensionsList: ExtensionsList
589 }; 605 };
590 }); 606 });
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