MD Downloads: compute content classes via data binding
[chromium-blink-merge.git] / chrome / browser / resources / md_downloads / item.html
blobd472c803928e8c14601e5b1d795458316968297d
1 <link rel="import" href="chrome://resources/html/action_link.html">
2 <link rel="import" href="chrome://resources/html/cr.html">
3 <link rel="import" href="chrome://resources/html/load_time_data.html">
4 <link rel="import" href="chrome://resources/polymer/v1_0/polymer/polymer.html">
5 <link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
6 <link rel="import" href="chrome://resources/polymer/v1_0/paper-material/paper-material.html">
7 <link rel="import" href="chrome://resources/polymer/v1_0/paper-progress/paper-progress.html">
8 <link rel="import" href="chrome://downloads/action_service.html">
9 <link rel="import" href="chrome://downloads/constants.html">
10 <link rel="import" href="chrome://downloads/throttled_icon_loader.html">
12 <dom-module id="downloads-item">
13 <template>
14 <div id="date-container">
15 <template is="dom-if" if="[[!hideDate]]">
16 <div>[[computeDate_(data_.since_string, data_.date_string)]]</div>
17 </template>
18 </div>
20 <paper-material id="content" on-dragstart="onDragStart_"
21 elevation$="[[computeElevation_(isActive_)]]"
22 class$="[[computeClass_(isActive_, isDangerous_, showProgress_)]]">
23 <div id="file-icon-wrapper" class="icon-wrapper">
24 <img class="icon" id="file-icon" alt="" hidden$="[[isDangerous_]]">
25 <div class="icon" id="warning" hidden$="[[!isDangerous_]]"></div>
26 </div>
28 <div id="details">
29 <div id="title-area"><!--
30 Can't have any line breaks.
31 --><a is="action-link" id="file-link" href$="[[data_.url]]"
32 on-click="onFileLinkClick_"
33 hidden$="[[!completelyOnDisk_]]">[[data_.file_name]]</a><!--
34 Before #name.
35 --><span id="name"
36 hidden$="[[completelyOnDisk_]]">[[data_.file_name]]</span>
37 <span id="tag"></span>
38 </div>
40 <a id="url" target="_blank" href$="[[data_.url]]">[[data_.url]]</a>
42 <div id="description"></div>
44 <template is="dom-if" if="[[showProgress_]]">
45 <paper-progress id="progress"
46 indeterminate$="[[isIndeterminate_(data_.percent)]]"
47 value$="[[data_.percent]]"></paper-progress>
48 </template>
50 <div id="safe" class="controls" hidden$="[[isDangerous_]]">
51 <template is="dom-if" if="[[completelyOnDisk_]]">
52 <paper-button id="show" on-click="onShowClick_"
53 lowercase noink>[[i18n_.show]]</paper-button>
54 </template>
55 <template is="dom-if" if="[[data_.retry]]">
56 <paper-button id="retry"
57 on-click="onRetryClick_">[[i18n_.retry]]</paper-button>
58 </template>
59 <template is="dom-if" if="[[isInProgress_]]">
60 <paper-button id="pause"
61 on-click="onPauseClick_">[[i18n_.pause]]</paper-button>
62 </template>
63 <template is="dom-if" if="[[data_.resume]]">
64 <paper-button id="resume"
65 on-click="onResumeClick_">[[i18n_.resume]]</paper-button>
66 </template>
67 <template is="dom-if" if="[[showCancel_]]">
68 <paper-button id="cancel"
69 on-click="onCancelClick_">[[i18n_.cancel]]</paper-button>
70 </template>
71 <span id="controlled-by"
72 i18n-values=".innerHTML:controlByExtension"></span>
73 </div>
75 <template is="dom-if" if="[[isDangerous_]]">
76 <div id="dangerous" class="controls">
77 <!-- Dangerous file types (e.g. .exe, .jar). -->
78 <template is="dom-if" if="[[!isMalware_]]">
79 <paper-button id="discard" on-click="onDiscardDangerous_"
80 class="discard">[[i18n_.discard]]</paper-button>
81 <paper-button id="save" on-click="onSaveDangerous_"
82 class="keep">[[i18n_.save]]</paper-button>
83 </template>
85 <!-- Things that safe browsing has determined to be dangerous. -->
86 <template is="dom-if" if="[[isMalware_]]">
87 <paper-button id="danger-remove" on-click="onDiscardDangerous_"
88 class="discard">[[i18n_.remove]]</paper-button>
89 <paper-button id="restore" on-click="onSaveDangerous_"
90 class="keep">[[i18n_.restore]</paper-button>
91 </template>
92 </div>
93 </template>
94 </div>
96 <div id="remove-wrapper" class="icon-wrapper">
97 <paper-icon-button id="remove" icon="clear"
98 style$="[[computeRemoveStyle_(isDangerous_, showCancel_)]]"
99 on-click="onRemoveClick_"></paper-icon-button>
100 </div>
102 <div id="incognito" hidden$="[[!data_.otr]]"></div>
103 </paper-material>
105 <div id="end-cap"></div>
107 </template>
108 <link rel="import" type="css" href="chrome://resources/css/action_link.css">
109 <link rel="import" type="css" href="chrome://downloads/shared_style.css">
110 <link rel="import" type="css" href="chrome://downloads/item.css">
111 <script src="chrome://downloads/item.js"></script>
112 </dom-module>