| 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 ItemView = Polymer({ | 6 var ItemView = Polymer({ |
| 7 is: 'item-view', | 7 is: 'item-view', |
| 8 | 8 |
| 9 /** @param {!downloads.ThrottledIconLoader} iconLoader */ | 9 /** @param {!downloads.ThrottledIconLoader} iconLoader */ |
| 10 factoryImpl: function(iconLoader) { | 10 factoryImpl: function(iconLoader) { |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 | 91 |
| 92 this.$.pause.hidden = !isInProgress; | 92 this.$.pause.hidden = !isInProgress; |
| 93 | 93 |
| 94 this.$.resume.hidden = !data.resume; | 94 this.$.resume.hidden = !data.resume; |
| 95 | 95 |
| 96 /** @const */ var isPaused = data.state == downloads.States.PAUSED; | 96 /** @const */ var isPaused = data.state == downloads.States.PAUSED; |
| 97 /** @const */ var showCancel = isPaused || isInProgress; | 97 /** @const */ var showCancel = isPaused || isInProgress; |
| 98 this.$.cancel.hidden = !showCancel; | 98 this.$.cancel.hidden = !showCancel; |
| 99 | 99 |
| 100 this.$['safe-remove'].hidden = showCancel || | 100 this.$['safe-remove'].hidden = showCancel || |
| 101 !loadTimeData.getBoolean('allow_deleting_history'); | 101 !loadTimeData.getBoolean('allowDeletingHistory'); |
| 102 | 102 |
| 103 /** @const */ var controlledByExtension = data.by_ext_id && | 103 /** @const */ var controlledByExtension = data.by_ext_id && |
| 104 data.by_ext_name; | 104 data.by_ext_name; |
| 105 this.$['controlled-by'].hidden = !controlledByExtension; | 105 this.$['controlled-by'].hidden = !controlledByExtension; |
| 106 if (controlledByExtension) { | 106 if (controlledByExtension) { |
| 107 var link = this.$['controlled-by'].querySelector('a'); | 107 var link = this.$['controlled-by'].querySelector('a'); |
| 108 link.href = 'chrome://extensions#' + data.by_ext_id; | 108 link.href = 'chrome://extensions#' + data.by_ext_id; |
| 109 link.setAttribute('column-type', 'controlled-by'); | 109 link.setAttribute('column-type', 'controlled-by'); |
| 110 link.textContent = data.by_ext_name; | 110 link.textContent = data.by_ext_name; |
| 111 } | 111 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 132 }, | 132 }, |
| 133 | 133 |
| 134 /** | 134 /** |
| 135 * @param {!downloads.Data} data | 135 * @param {!downloads.Data} data |
| 136 * @return {string} Text describing the danger of a download. Empty if not | 136 * @return {string} Text describing the danger of a download. Empty if not |
| 137 * dangerous. | 137 * dangerous. |
| 138 */ | 138 */ |
| 139 getDangerText_: function(data) { | 139 getDangerText_: function(data) { |
| 140 switch (data.danger_type) { | 140 switch (data.danger_type) { |
| 141 case downloads.DangerType.DANGEROUS_FILE: | 141 case downloads.DangerType.DANGEROUS_FILE: |
| 142 return loadTimeData.getStringF('danger_file_desc', data.file_name); | 142 return loadTimeData.getStringF('dangerFileDesc', data.file_name); |
| 143 case downloads.DangerType.DANGEROUS_URL: | 143 case downloads.DangerType.DANGEROUS_URL: |
| 144 return loadTimeData.getString('danger_url_desc'); | 144 return loadTimeData.getString('dangerUrlDesc'); |
| 145 case downloads.DangerType.DANGEROUS_CONTENT: // Fall through. | 145 case downloads.DangerType.DANGEROUS_CONTENT: // Fall through. |
| 146 case downloads.DangerType.DANGEROUS_HOST: | 146 case downloads.DangerType.DANGEROUS_HOST: |
| 147 return loadTimeData.getStringF('danger_content_desc', data.file_name); | 147 return loadTimeData.getStringF('dangerContentDesc', data.file_name); |
| 148 case downloads.DangerType.UNCOMMON_CONTENT: | 148 case downloads.DangerType.UNCOMMON_CONTENT: |
| 149 return loadTimeData.getStringF('danger_uncommon_desc', | 149 return loadTimeData.getStringF('dangerUncommonDesc', data.file_name); |
| 150 data.file_name); | |
| 151 case downloads.DangerType.POTENTIALLY_UNWANTED: | 150 case downloads.DangerType.POTENTIALLY_UNWANTED: |
| 152 return loadTimeData.getStringF('danger_settings_desc', | 151 return loadTimeData.getStringF('dangerSettingsDesc', data.file_name); |
| 153 data.file_name); | |
| 154 default: | 152 default: |
| 155 return ''; | 153 return ''; |
| 156 } | 154 } |
| 157 }, | 155 }, |
| 158 | 156 |
| 159 /** | 157 /** |
| 160 * @param {!downloads.Data} data | 158 * @param {!downloads.Data} data |
| 161 * @return {string} User-visible status update text. | 159 * @return {string} User-visible status update text. |
| 162 * @private | 160 * @private |
| 163 */ | 161 */ |
| 164 getStatusText_: function(data) { | 162 getStatusText_: function(data) { |
| 165 switch (data.state) { | 163 switch (data.state) { |
| 166 case downloads.States.IN_PROGRESS: | 164 case downloads.States.IN_PROGRESS: |
| 167 case downloads.States.PAUSED: // Fallthrough. | 165 case downloads.States.PAUSED: // Fallthrough. |
| 168 assert(typeof data.progress_status_text == 'string'); | 166 assert(typeof data.progress_status_text == 'string'); |
| 169 return data.progress_status_text; | 167 return data.progress_status_text; |
| 170 case downloads.States.CANCELLED: | 168 case downloads.States.CANCELLED: |
| 171 return loadTimeData.getString('status_cancelled'); | 169 return loadTimeData.getString('statusCancelled'); |
| 172 case downloads.States.DANGEROUS: | 170 case downloads.States.DANGEROUS: |
| 173 break; // Intentionally hit assertNotReached(); at bottom. | 171 break; // Intentionally hit assertNotReached(); at bottom. |
| 174 case downloads.States.INTERRUPTED: | 172 case downloads.States.INTERRUPTED: |
| 175 assert(typeof data.last_reason_text == 'string'); | 173 assert(typeof data.last_reason_text == 'string'); |
| 176 return data.last_reason_text; | 174 return data.last_reason_text; |
| 177 case downloads.States.COMPLETE: | 175 case downloads.States.COMPLETE: |
| 178 return data.file_externally_removed ? | 176 return data.file_externally_removed ? |
| 179 loadTimeData.getString('status_removed') : ''; | 177 loadTimeData.getString('statusRemoved') : ''; |
| 180 } | 178 } |
| 181 assertNotReached(); | 179 assertNotReached(); |
| 182 return ''; | 180 return ''; |
| 183 }, | 181 }, |
| 184 | 182 |
| 185 /** | 183 /** |
| 186 * @private | 184 * @private |
| 187 * @param {Event} e | 185 * @param {Event} e |
| 188 */ | 186 */ |
| 189 onSafeDragstart_: function(e) { | 187 onSafeDragstart_: function(e) { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 }, | 239 }, |
| 242 | 240 |
| 243 /** @private */ | 241 /** @private */ |
| 244 onDiscardClick_: function() { | 242 onDiscardClick_: function() { |
| 245 chrome.send('discardDangerous', [this.id_]); | 243 chrome.send('discardDangerous', [this.id_]); |
| 246 }, | 244 }, |
| 247 }); | 245 }); |
| 248 | 246 |
| 249 return {ItemView: ItemView}; | 247 return {ItemView: ItemView}; |
| 250 }); | 248 }); |
| OLD | NEW |