| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 'use strict'; | 5 'use strict'; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Progress center at the background page. | 8 * Progress center at the background page. |
| 9 * @constructor | 9 * @constructor |
| 10 */ | 10 */ |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 | 120 |
| 121 // Create/update the notification with the item. | 121 // Create/update the notification with the item. |
| 122 this.queue_.run(function(proceed) { | 122 this.queue_.run(function(proceed) { |
| 123 var params = { | 123 var params = { |
| 124 title: chrome.runtime.getManifest().name, | 124 title: chrome.runtime.getManifest().name, |
| 125 iconUrl: chrome.runtime.getURL('/common/images/icon96.png'), | 125 iconUrl: chrome.runtime.getURL('/common/images/icon96.png'), |
| 126 type: item.state === ProgressItemState.PROGRESSING ? 'progress' : 'basic', | 126 type: item.state === ProgressItemState.PROGRESSING ? 'progress' : 'basic', |
| 127 message: item.message, | 127 message: item.message, |
| 128 buttons: item.cancelable ? [{title: str('CANCEL_LABEL')}] : undefined, | 128 buttons: item.cancelable ? [{title: str('CANCEL_LABEL')}] : undefined, |
| 129 progress: item.state === ProgressItemState.PROGRESSING ? | 129 progress: item.state === ProgressItemState.PROGRESSING ? |
| 130 item.progressRateByPercent : undefined | 130 item.progressRateInPercent : undefined, |
| 131 priority: (item.state === ProgressItemState.ERROR || !item.quiet) ? 0 : -1 |
| 131 }; | 132 }; |
| 132 if (newlyAdded) | 133 if (newlyAdded) |
| 133 chrome.notifications.create(item.id, params, proceed); | 134 chrome.notifications.create(item.id, params, proceed); |
| 134 else | 135 else |
| 135 chrome.notifications.update(item.id, params, proceed); | 136 chrome.notifications.update(item.id, params, proceed); |
| 136 }.bind(this)); | 137 }.bind(this)); |
| 137 }; | 138 }; |
| 138 | 139 |
| 139 /** | 140 /** |
| 140 * Handles cancel button click. | 141 * Handles cancel button click. |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 * @return {number} Item index. Returns -1 If the item is not found. | 249 * @return {number} Item index. Returns -1 If the item is not found. |
| 249 * @private | 250 * @private |
| 250 */ | 251 */ |
| 251 ProgressCenter.prototype.getItemIndex_ = function(id) { | 252 ProgressCenter.prototype.getItemIndex_ = function(id) { |
| 252 for (var i = 0; i < this.items_.length; i++) { | 253 for (var i = 0; i < this.items_.length; i++) { |
| 253 if (this.items_[i].id === id) | 254 if (this.items_[i].id === id) |
| 254 return i; | 255 return i; |
| 255 } | 256 } |
| 256 return -1; | 257 return -1; |
| 257 }; | 258 }; |
| OLD | NEW |