summaryrefslogtreecommitdiff
path: root/chromium/chrome/browser/resources/md_extensions/item.html
blob: c396d2e4c956d2f9c16b7ee77ac6c9d7fd549a0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
<link rel="import" href="chrome://resources/html/polymer.html">

<link rel="import" href="chrome://resources/cr_elements/cr_icons_css.html">
<link rel="import" href="chrome://resources/cr_elements/hidden_style_css.html">
<link rel="import" href="chrome://resources/cr_elements/paper_button_style_css.html">
<link rel="import" href="chrome://resources/cr_elements/paper_toggle_style_css.html">
<link rel="import" href="chrome://resources/html/action_link.html">
<link rel="import" href="chrome://resources/html/action_link_css.html">
<link rel="import" href="chrome://resources/html/assert.html">
<link rel="import" href="chrome://resources/html/cr.html">
<link rel="import" href="chrome://resources/html/i18n_behavior.html">
<link rel="import" href="chrome://resources/html/load_time_data.html">
<link rel="import" href="chrome://extensions/icons.html">
<link rel="import" href="chrome://extensions/item_util.html">
<link rel="import" href="chrome://extensions/strings.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-icons/iron-icons.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-icons/communication-icons.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-flex-layout/iron-flex-layout-classes.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/shadow.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-toggle-button/paper-toggle-button.html">
<link rel="import" href="chrome://extensions/navigation_helper.html">

<dom-module id="extensions-item">
  <template>
    <style include="iron-flex cr-hidden-style cr-icons action-link paper-button-style paper-toggle-style">
      #icon-wrapper {
        align-self: flex-start;
        display: flex;
        padding: 6px;
      }

      #icon {
        height: 36px;
        width: 36px;
      }

      #card {
        @apply(--shadow-elevation-2dp);
        background: white;
        display: flex;
        flex-direction: column;
        height: 160px;
        width: 400px;
      }

      #card.dev-mode {
        height: 208px;
      }

      #card.disabled {
        opacity: 0.6;
      }

      #main {
        display: flex;
        flex-grow: 1;
        padding: 16px 20px 17px;
      }

      #content {
        -webkit-margin-start: 24px;
        display: flex;
        flex-direction: column;
        width: 100%;
      }

      #name-and-version {
        @apply(--cr-primary-text);
        margin-bottom: 4px;
      }

      #name {
        -webkit-margin-end: 8px;
      }

      #description,
      #warnings {
        flex-grow: 1;
        margin-bottom: 8px;
      }

      #description,
      #version,
      #extension-id,
      #inspect-views,
      #button-strip {
        /* TODO(dschuyler): use --cr-secondary-text. */
        color: var(--paper-grey-600);
        font-weight: 400;
      }

      #button-strip {
        -webkit-padding-end: 4px;
        -webkit-padding-start: var(--cr-section-padding);
        border-top: var(--cr-separator-line);
        box-sizing: border-box;
        height: var(--cr-section-min-height);
        padding-bottom: 8px;
        padding-top: 8px;
      }

      #button-strip paper-button {
        margin: 0 4px;
      }

      #source-indicator {
        -webkit-margin-start: 30px;
        margin-top: 30px;
        position: absolute;
      }

      .source-icon-wrapper {
        align-items: center;
        background: rgb(241, 89, 43);
        border-radius: 50%;  /* 50% border radius == a circle */
        box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.22),
                    0 2px 2px 0 rgba(0, 0, 0, 0.12);
        display: flex;
        height: 22px;
        justify-content: center;
        width: 22px;
      }

      #source-indicator iron-icon {
        color: white;
        height: 16px;
        width: 16px;
      }

      #source-indicator-text {
        -webkit-margin-start: 11px;  /* To align with the center of the icon. */
        background: black;
        border-radius: 2px;
        color: white;
        display: none;
        margin-top: 8px;
        opacity: 0.6;
        padding: 8px 12px;
        position: absolute;
        transform: translateX(-50%);  /* Move back 50% of width so that the
                                         text and icon share an x-center. */
      }

      #source-indicator:hover #source-indicator-text {
        display: block;
      }

      paper-toggle-button {
        -webkit-margin-end: 8px;  /* Avoid ripple from overlapping container. */
        cursor: pointer;
      }

      .action-button {
        color: var(--google-blue-500);
      }

      #dev-reload-button {
        -webkit-margin-end: 12px;
      }

      #warnings {
        color: var(--google-red-700);
      }

      #blacklisted-warning:empty {
        display: none;
      }
    </style>
    <div id="card" class$="[[computeClasses_(data.state, inDevMode)]]">
      <div id="main">
        <template is="dom-if"
            if="[[computeSourceIndicatorIcon_(data.*)]]">
          <div id="source-indicator">
            <div class="source-icon-wrapper">
              <iron-icon icon="[[computeSourceIndicatorIcon_(data.*)]]">
              </iron-icon>
            </div>
            <div id="source-indicator-text">
              [[computeSourceIndicatorText_(data.*)]]
            </div>
          </div>
        </template>
        <div id="icon-wrapper">
          <img alt="" id="icon" src="[[data.iconUrl]]">
        </div>
        <div id="content">
          <div id="name-and-version" class="layout horizontal center">
            <div id="name">[[data.name]]</div>
            <template is="dom-if" if="[[inDevMode]]">
              <span id="version">[[data.version]]</span>
            </template>
          </div>
          <div id="description" hidden$="[[hasWarnings_(data.*)]]">
            [[data.description]]
          </div>
          <div id="warnings" hidden$="[[!hasWarnings_(data.*)]]">
            <div id="suspicious-warning"
                 hidden$="[[!data.disableReasons.suspiciousInstall]]">
              $i18n{itemSuspiciousInstall}
            </div>
            <div id="corrupted-warning"
                hidden$="[[!data.disableReasons.corruptInstall]]">
              $i18n{itemCorruptInstall}
            </div>
            <div id="blacklisted-warning"><!-- No whitespace
              -->[[data.blacklistText]]<!-- so we can use :empty in css.
           --></div>
          </div>
          <template is="dom-if" if="[[inDevMode]]">
            <div id="extension-id">[[data.id]]</div>
            <template is="dom-if"
                if="[[!computeInspectViewsHidden_(data.views)]]">
              <div id="inspect-views">
                <span>$i18n{itemInspectViews}</span>
                <a is="action-link" on-tap="onInspectTap_">
                  [[computeFirstInspectLabel_(data.views)]]
                </a>
                <a is="action-link"
                    hidden$="[[computeExtraViewsHidden_(data.views)]]"
                    on-tap="onExtraInspectTap_">
                  [[computeExtraInspectLabel_(data.views)]]
                </a>
              </div>
            </template>
          </template>
        </div>
      </div>
      <div id="button-strip" class="layout horizontal center">
        <div class="layout flex horizontal center">
          <paper-button id="details-button" on-tap="onDetailsTap_">
            $i18n{itemDetails}
          </paper-button>
          <paper-button id="remove-button" on-tap="onRemoveTap_"
              hidden="[[isControlled_(data.controlledInfo)]]">
            $i18n{itemRemove}
          </paper-button>
          <paper-button id="errors-button" on-tap="onErrorsTap_"
              hidden$="[[computeErrorsHidden_(data.*)]]">
            $i18n{itemErrors}
          </paper-button>
        </div>
        <template is="dom-if" if="[[!computeDevReloadButtonHidden_(data.*)]]">
          <button id="dev-reload-button" is="paper-icon-button-light"
              class="icon-refresh no-overlap" on-tap="onReloadTap_">
          </button>
        </template>
        <paper-button id="repair-button" class="action-button"
            on-tap="onRepairTap_"
            hidden$="[[!data.disableReasons.corruptInstall]]">
          $i18n{itemRepair}
        </paper-button>
        <paper-button id="terminated-reload-button" on-tap="onReloadTap_"
            class="action-button"
            hidden$="[[!isTerminated_(data.state)]]">
          $i18n{itemReload}
        </paper-button>
        <paper-toggle-button id="enable-toggle" class="action-button"
            checked="[[isEnabled_(data.state)]]" on-change="onEnableChange_"
            disabled="[[!isEnableToggleEnabled_(data.*)]]"
            hidden$="[[!showEnableToggle_(data.*)]]">
        </paper-toggle-button>
      </div>
    </div>
  </template>
  <script src="chrome://extensions/item.js"></script>
</dom-module>