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

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

Issue 1313453002: Make cr.ui.Focus* play nice with Shadow DOM and MD chrome://downloads (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 5 years, 3 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
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 Item = Polymer({ 6 var Item = Polymer({
7 is: 'downloads-item', 7 is: 'downloads-item',
8 8
9 /** 9 /**
10 * @param {!downloads.ThrottledIconLoader} iconLoader 10 * @param {!downloads.ThrottledIconLoader} iconLoader
11 * @param {!downloads.ActionService} actionService 11 * @param {!downloads.ActionService} actionService
12 */ 12 */
13 factoryImpl: function(iconLoader, actionService) { 13 factoryImpl: function(iconLoader, actionService) {
14 /** @private {!downloads.ThrottledIconLoader} */ 14 /** @private {!downloads.ThrottledIconLoader} */
15 this.iconLoader_ = iconLoader; 15 this.iconLoader_ = iconLoader;
16 16
17 /** @private {!downloads.ActionService} */ 17 /** @private {!downloads.ActionService} */
18 this.actionService_ = actionService; 18 this.actionService_ = actionService;
19 }, 19 },
20 20
21 properties: { 21 properties: {
22 hideDate: { 22 hideDate: {
23 reflectToAttribute: true, 23 reflectToAttribute: true,
24 type: Boolean, 24 type: Boolean,
25 value: false, 25 value: false,
26 }, 26 },
27 27
28 readyPromise: {
29 type: Object,
30 value: function() {
31 return new Promise(function(resolve, reject) {
32 this.resolveReadyPromise_ = resolve;
33 }.bind(this));
34 },
35 },
36
28 scrollbarWidth: { 37 scrollbarWidth: {
29 type: Number, 38 type: Number,
30 value: 0, 39 value: 0,
31 observer: 'onScrollbarWidthChange_', 40 observer: 'onScrollbarWidthChange_',
32 }, 41 },
33 42
34 isDangerous_: { 43 isDangerous_: {
35 type: Boolean, 44 type: Boolean,
36 value: false, 45 value: false,
37 }, 46 },
38 47
39 isIncognito_: { 48 isIncognito_: {
40 type: Boolean, 49 type: Boolean,
41 value: false, 50 value: false,
42 }, 51 },
43 52
44 /** Only set when |isDangerous| is true. */ 53 /** Only set when |isDangerous| is true. */
45 isMalware_: Boolean, 54 isMalware_: Boolean,
46 }, 55 },
47 56
57 ready: function() {
58 this.content = this.$.content;
59 this.resolveReadyPromise_();
60 },
61
48 /** @param {!downloads.Data} data */ 62 /** @param {!downloads.Data} data */
49 update: function(data) { 63 update: function(data) {
50 assert(!this.id_ || data.id == this.id_); 64 assert(!this.id_ || data.id == this.id_);
51 this.id_ = data.id; // This is the only thing saved from |data|. 65 this.id_ = data.id; // This is the only thing saved from |data|.
52 66
53 this.isIncognito_ = data.otr; 67 this.isIncognito_ = data.otr;
54 68
55 // Danger-independent UI and controls. 69 // Danger-independent UI and controls.
56 var since = data.since_string; 70 var since = data.since_string;
57 this.ensureTextIs_(this.$.since, since); 71 this.ensureTextIs_(this.$.since, since);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 137
124 hideRemove = showCancel || 138 hideRemove = showCancel ||
125 !loadTimeData.getBoolean('allowDeletingHistory'); 139 !loadTimeData.getBoolean('allowDeletingHistory');
126 140
127 /** @const */ var controlledByExtension = data.by_ext_id && 141 /** @const */ var controlledByExtension = data.by_ext_id &&
128 data.by_ext_name; 142 data.by_ext_name;
129 this.$['controlled-by'].hidden = !controlledByExtension; 143 this.$['controlled-by'].hidden = !controlledByExtension;
130 if (controlledByExtension) { 144 if (controlledByExtension) {
131 var link = this.$['controlled-by'].querySelector('a'); 145 var link = this.$['controlled-by'].querySelector('a');
132 link.href = 'chrome://extensions#' + data.by_ext_id; 146 link.href = 'chrome://extensions#' + data.by_ext_id;
133 link.setAttribute('focus-type', 'controlled-by');
134 link.textContent = data.by_ext_name; 147 link.textContent = data.by_ext_name;
135 } 148 }
136 149
137 var icon = 'chrome://fileicon/' + encodeURIComponent(data.file_path); 150 var icon = 'chrome://fileicon/' + encodeURIComponent(data.file_path);
138 this.iconLoader_.loadScaledIcon(this.$['file-icon'], icon); 151 this.iconLoader_.loadScaledIcon(this.$['file-icon'], icon);
139 } 152 }
140 153
141 this.$.remove.style.visibility = hideRemove ? 'hidden' : ''; 154 this.$.remove.style.visibility = hideRemove ? 'hidden' : '';
142 }, 155 },
143 156
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 }, 284 },
272 285
273 /** @private */ 286 /** @private */
274 onShowClick_: function() { 287 onShowClick_: function() {
275 this.actionService_.show(this.id_); 288 this.actionService_.show(this.id_);
276 }, 289 },
277 }); 290 });
278 291
279 return {Item: Item}; 292 return {Item: Item};
280 }); 293 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698