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

Side by Side Diff: chrome/browser/resources/md_downloads/toolbar.js

Issue 2167383003: MD Downloads: simplify how we detect focus changes that close the "More actions..." menu (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@roll-polymer2
Patch Set: merge Created 4 years, 4 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 | « chrome/browser/resources/md_downloads/crisper.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 cr.define('downloads', function() { 5 cr.define('downloads', function() {
6 var Toolbar = Polymer({ 6 var Toolbar = Polymer({
7 is: 'downloads-toolbar', 7 is: 'downloads-toolbar',
8 8
9 attached: function() { 9 attached: function() {
10 // isRTL() only works after i18n_template.js runs to set <html dir>. 10 // isRTL() only works after i18n_template.js runs to set <html dir>.
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 67
68 /** 68 /**
69 * @param {!Event} e 69 * @param {!Event} e
70 * @private 70 * @private
71 */ 71 */
72 onItemBlur_: function(e) { 72 onItemBlur_: function(e) {
73 var menu = /** @type {PaperMenuElement} */(this.$$('paper-menu')); 73 var menu = /** @type {PaperMenuElement} */(this.$$('paper-menu'));
74 if (menu.items.indexOf(e.relatedTarget) >= 0) 74 if (menu.items.indexOf(e.relatedTarget) >= 0)
75 return; 75 return;
76 76
77 // This can be this.$.more.restoreFocusOnClose = false when this lands: 77 this.$.more.restoreFocusOnClose = false;
78 // https://github.com/PolymerElements/paper-menu-button/pull/94
79 this.$.more.$.dropdown.restoreFocusOnClose = false;
80 this.closeMoreActions_(); 78 this.closeMoreActions_();
81 this.$.more.$.dropdown.restoreFocusOnClose = true; 79 this.$.more.restoreFocusOnClose = true;
82 }, 80 },
83 81
84 /** @private */ 82 /** @private */
85 onPaperDropdownOpen_: function() { 83 onPaperDropdownOpen_: function() {
86 this.boundClose_ = this.boundClose_ || this.closeMoreActions_.bind(this); 84 this.boundClose_ = this.boundClose_ || this.closeMoreActions_.bind(this);
87 window.addEventListener('resize', this.boundClose_); 85 window.addEventListener('resize', this.boundClose_);
88 }, 86 },
89 87
90 /** 88 /**
91 * @param {!CustomEvent} event 89 * @param {!CustomEvent} event
(...skipping 18 matching lines...) Expand all
110 }); 108 });
111 109
112 return {Toolbar: Toolbar}; 110 return {Toolbar: Toolbar};
113 }); 111 });
114 112
115 // TODO(dbeam): https://github.com/PolymerElements/iron-dropdown/pull/16/files 113 // TODO(dbeam): https://github.com/PolymerElements/iron-dropdown/pull/16/files
116 /** @suppress {checkTypes} */ 114 /** @suppress {checkTypes} */
117 (function() { 115 (function() {
118 Polymer.IronDropdownScrollManager.pushScrollLock = function() {}; 116 Polymer.IronDropdownScrollManager.pushScrollLock = function() {};
119 })(); 117 })();
OLDNEW
« no previous file with comments | « chrome/browser/resources/md_downloads/crisper.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698