OLD | NEW |
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 Manager = Polymer({ | 6 var Manager = Polymer({ |
7 is: 'downloads-manager', | 7 is: 'downloads-manager', |
8 | 8 |
9 properties: { | 9 properties: { |
10 /** @private */ | 10 /** @private */ |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 this.removeAttribute('loading'); | 82 this.removeAttribute('loading'); |
83 this.loaded_.resolve(); | 83 this.loaded_.resolve(); |
84 } | 84 } |
85 | 85 |
86 this.spinnerActive_ = false; | 86 this.spinnerActive_ = false; |
87 }, | 87 }, |
88 | 88 |
89 /** @private */ | 89 /** @private */ |
90 itemsChanged_: function() { | 90 itemsChanged_: function() { |
91 this.hasDownloads_ = this.items_.length > 0; | 91 this.hasDownloads_ = this.items_.length > 0; |
| 92 |
| 93 if (this.inSearchMode_) { |
| 94 Polymer.IronA11yAnnouncer.requestAvailability(); |
| 95 this.fire('iron-announce', { |
| 96 text: this.hasDownloads_ ? |
| 97 loadTimeData.getStringF( |
| 98 'searchResultsFor', this.$.toolbar.getSearchText()) : |
| 99 this.noDownloadsText_() |
| 100 }); |
| 101 } |
92 }, | 102 }, |
93 | 103 |
94 /** | 104 /** |
95 * @return {string} The text to show when no download items are showing. | 105 * @return {string} The text to show when no download items are showing. |
96 * @private | 106 * @private |
97 */ | 107 */ |
98 noDownloadsText_: function() { | 108 noDownloadsText_: function() { |
99 return loadTimeData.getString( | 109 return loadTimeData.getString( |
100 this.inSearchMode_ ? 'noSearchResults' : 'noDownloads'); | 110 this.inSearchMode_ ? 'noSearchResults' : 'noDownloads'); |
101 }, | 111 }, |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 Manager.removeItem = function(index) { | 231 Manager.removeItem = function(index) { |
222 Manager.get().removeItem_(index); | 232 Manager.get().removeItem_(index); |
223 }; | 233 }; |
224 | 234 |
225 Manager.updateItem = function(index, data) { | 235 Manager.updateItem = function(index, data) { |
226 Manager.get().updateItem_(index, data); | 236 Manager.get().updateItem_(index, data); |
227 }; | 237 }; |
228 | 238 |
229 return {Manager: Manager}; | 239 return {Manager: Manager}; |
230 }); | 240 }); |
OLD | NEW |