summaryrefslogtreecommitdiffstats
path: root/chromium/chrome/browser/resources/print_preview/ui/destination_dialog.html
blob: a9f91768268050f3752a7855011d66f95d3f5e62 (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
<link rel="import" href="chrome://resources/html/polymer.html">

<link rel="import" href="chrome://resources/cr_elements/cr_button/cr_button.html">
<link rel="import" href="chrome://resources/cr_elements/cr_dialog/cr_dialog.html">
<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/hidden_style_css.html">
<link rel="import" href="chrome://resources/cr_elements/icons.html">
<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
<!-- The imports below are needed as an action-link is added to the promo-text
  div to create the cloud print "Sign in" link when this element is
  attached. -->
<link rel="import" href="chrome://resources/html/action_link.html">
<link rel="import" href="chrome://resources/cr_elements/action_link_css.html">
<link rel="import" href="chrome://resources/html/event_tracker.html">
<link rel="import" href="chrome://resources/html/i18n_behavior.html">
<link rel="import" href="chrome://resources/html/list_property_update_behavior.html">
<link rel="import" href="chrome://resources/cr_elements/md_select_css.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html">
<link rel="import" href="icons.html">
<link rel="import" href="../metrics.html">
<link rel="import" href="../native_layer.html">
<link rel="import" href="../print_preview_utils.html">
<link rel="import" href="../data/destination.html">
<link rel="import" href="../data/destination_store.html">
<link rel="import" href="../data/invitation.html">
<link rel="import" href="../data/invitation_store.html">
<link rel="import" href="destination_list.html">
<link rel="import" href="print_preview_search_box.html">
<link rel="import" href="print_preview_shared_css.html">
<link rel="import" href="print_preview_vars_css.html">
<link rel="import" href="provisional_destination_resolver.html">
<link rel="import" href="strings.html">
<link rel="import" href="throbber_css.html">

<dom-module id="print-preview-destination-dialog">
  <template>
    <style include="print-preview-shared action-link md-select cr-hidden-style
        throbber">
      #dialog::part(dialog) {
        height: calc(100vh - 2 * var(--print-preview-dialog-margin));
        max-width: 640px;
        width:  calc(100vw - 2 * var(--print-preview-dialog-margin));
      }

      #dialog::part(wrapper) {
        height: calc(100vh - 2 * var(--print-preview-dialog-margin));
      }

      #dialog::part(body-container) {
        flex: 1;
      }

      print-preview-search-box {
        margin-bottom: 16px;
        margin-top: 14px;
      }

      .user-info {
        font-size: calc(13 / 15 * 1em);
        line-height: calc(20 / 15 * 1em);
        margin-bottom: 14px;
        margin-top: 8px;
      }

      .user-info .account-select-label {
        padding-inline-end: 18px;
      }

      .user-info .account-select {
        width: auto
      }

      cr-dialog [slot=body] {
        height: 100%;
      }

      div[slot='button-container'] {
        justify-content: space-between;
      }

      cr-button {
        font-size: calc(12 / 13 * 1em);
      }

      .cancel-button {
        margin-inline-end: 0;
      }

      #dialog #promos {
        background: rgb(248, 249, 250);
        padding: 0;
      }

      @media (prefers-color-scheme: dark) {
        #dialog #promos {
          background: rgb(50, 54, 57);
        }
      }

      #dialog .promo {
        align-items: center;
        color: var(--cr-primary-text-color);
        display: flex;
        padding: 16px 20px;
      }

      #cloudprintPromo .promo-text {
        flex: 1;
      }

      #cloudprintPromo iron-icon {
        margin-inline-end: 16px;
        width: 20px;
      }

      #cloudPrintClose {
        --cr-icon-button-size: 20px;
        --cr-icon-button-icon-size: 16px;
        margin-inline-start: 16px;
        min-height: 14px;
        min-width: 14px;
        padding: 0;
      }

      #invitationPromo {
        flex-direction: column;
        text-align: center;
      }

      #invitationPromo .invitation-buttons {
        display: flex;
        padding: 12px 0;
      }

      #invitationPromo cr-button {
        margin: 0 4px;
      }

      @media (prefers-color-scheme: light) {
        #invitationPromo cr-button {
          background-color: white;
        }
      }

      #invitationPromo invitation-details {
        color: var(--cr-secondary-text-color);
        font-size: calc(10 / 13 * 1em);
        font-weight: 500;
      }
    </style>
    <cr-dialog id="dialog" on-close="onCloseOrCancel_">
      <div slot="title" id="header">
        <div>$i18n{destinationSearchTitle}</div>
        <div class="user-info" hidden$="[[!activeUser]]" hidden>
          <label class="account-select-label" id="accountSelectLabel">
            $i18n{accountSelectTitle}
          </label>
          <select class="md-select account-select"
              aria-labelledby="accountSelectLabel" on-change="onUserChange_">
            <template is="dom-repeat" items="[[users]]">
              <option value="[[item]]">
                [[item]]
              </option>
            </template>
            <option value="">$i18n{addAccountTitle}</option>
          </select>
        </div>
        <print-preview-search-box id="searchBox"
            label="$i18n{searchBoxPlaceholder}" search-query="{{searchQuery_}}"
            autofocus>
        </print-preview-search-box>
      </div>
      <div slot="body">
        <print-preview-destination-list id="printList"
            destinations="[[destinations_]]"
            loading-destinations="[[loadingDestinations_]]"
            search-query="[[searchQuery_]]"
            list-name="$i18n{printDestinationsTitle}"
            on-destination-selected="onDestinationSelected_">
        </print-preview-destination-list>
        <print-preview-provisional-destination-resolver id="provisionalResolver"
            destination-store="[[destinationStore]]">
        </print-preview-provisional-destination-resolver>
      </div>
      <div slot="button-container">
        <cr-button on-click="onOpenSettingsPrintPage_">
          $i18n{manage}
        </cr-button>
        <cr-button class="cancel-button" on-click="onCancelButtonClick_">
          $i18n{cancel}
        </cr-button>
      </div>
      <div id="promos" slot="footer" hidden="[[!shouldShowFooter_(
          shouldShowCloudPrintPromo_, invitation_)]]">
        <div class="promo" id="cloudprintPromo"
            hidden$="[[!shouldShowCloudPrintPromo_]]">
          <iron-icon icon="print-preview:cloud-queue" alt=""></iron-icon>
          <div class="promo-text"></div>
          <cr-icon-button id="cloudPrintClose" class="icon-clear"
              on-click="onCloudPrintPromoDismissed_"></cr-icon-button>
        </div>
        <div class="promo" id="invitationPromo" hidden="[[!invitation_]]">
          <div inner-h-t-m-l="[[getInvitationText_(invitation_)]]"></div>
          <div class="invitation-buttons">
            <cr-button on-click="onInvitationAcceptClick_">
              [[getAcceptButtonText_(invitation_)]]
            </cr-button>
            <cr-button on-click="onInvitationRejectClick_">
              $i18n{reject}
            </cr-button>
            <div id="invitation-process-throbber" class="throbber" hidden></div>
          </div>
          <div class="invitation-details">
            $i18nRaw{registerPrinterInformationMessage}
          </div>
        </div>
      </div>
    </cr-dialog>
  </template>
  <script src="destination_dialog.js"></script>
</dom-module>