summaryrefslogtreecommitdiffstats
path: root/chromium/chrome/browser/resources/settings/people_page/account_manager.html
blob: 3addbf6027c1f3c16d835f22f7110f59cd17229d (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
<link rel="import" href="chrome://resources/html/polymer.html">

<link rel="import" href="chrome://resources/cr_elements/cr_action_menu/cr_action_menu.html">
<link rel="import" href="chrome://resources/cr_elements/cr_button/cr_button.html">
<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/policy/cr_policy_indicator.html">
<link rel="import" href="chrome://resources/html/i18n_behavior.html">
<link rel="import" href="chrome://resources/html/icon.html">
<link rel="import" href="chrome://resources/html/util.html">
<link rel="import" href="chrome://resources/html/web_ui_listener_behavior.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-flex-layout/iron-flex-layout-classes.html">
<link rel="import" href="../i18n_setup.html">
<link rel="import" href="../route.html">
<link rel="import" href="../settings_shared_css.html">
<link rel="import" href="account_manager_browser_proxy.html">

<dom-module id="settings-account-manager">
  <template>
    <style include="settings-shared iron-flex iron-flex-alignment">
      :host {
        --add-account-margin-top: 16px;
      }

      .profile-icon {
        background: center / cover no-repeat;
        border-radius: 20px;
        flex-shrink: 0;
        height: 40px;
        width: 40px;
      }

      .account-list-item {
        padding-inline-end: 8px;
        padding-inline-start: 0;
      }

      .account-manager-description {
        /* Up to 70 characters. */
        max-width: 35em;
      }

      #outer {
        margin-inline-end: var(--cr-section-padding);
        margin-inline-start: 60px;
      }

      #account-list-header {
        padding-bottom: 8px;
      }

      cr-policy-indicator {
        margin-inline-end: 1em;
        margin-top: var(--add-account-margin-top);
      }

      #add-account-button {
        margin-top: var(--add-account-margin-top);
      }

      #add-account-icon {
        -webkit-mask-image: url(chrome://resources/images/add.svg);
        background-color: currentColor;
        height: 24px;
        margin-inline-end: 0.5em;
        width: 24px;
      }

      .signed-out-text {
        color: var(--google-red-600);
      }

      .error-badge {
        background: url(chrome://resources/images/error_badge.svg)
            center / cover no-repeat;
        display: block;
        height: 20px;
        left: 60%;
        position: relative;
        top: 60%;
        width: 20px;
      }

      :host-context([dir='rtl']) .error-badge {
        left: auto;
        right: 60%;
      }

      .management-status {
        color: var(--cr-secondary-text-color);
      }
    </style>

    <div class="settings-box first">
      <span class="account-manager-description">
        $i18n{accountManagerDescription}
        <a href="$i18nRaw{accountManagerLearnMoreUrl}" target="_blank">
          $i18n{learnMore}
        </a>
      </span>
    </div>

    <div class="settings-box first">
      <div id="account-list-header" class="flex">
        <h2>$i18n{accountListHeader}</h2>
      </div>
      <cr-policy-indicator
          hidden="[[isSecondaryGoogleAccountSigninAllowed_()]]"
          indicator-type="userPolicy">
      </cr-policy-indicator>
      <cr-button disabled="[[!isSecondaryGoogleAccountSigninAllowed_()]]"
          id="add-account-button" on-tap="addAccount_">
        <div id="add-account-icon"></div>
        $i18n{addAccountLabel}
      </cr-button>
    </div>

    <div id="outer" class="layout vertical nowrap">
      <template is="dom-repeat" id="account-list" items="[[accounts_]]">
        <div class="settings-box account-list-item">

          <div class="profile-icon"
              style="background-image: [[getIconImageSet_(item.pic)]]">
            <template is="dom-if" if="[[!item.isSignedIn]]">
              <span class="error-badge"></span>
            </template>
          </div>

          <div class="middle two-line no-min-width">
            <div class="flex text-elide">
              <!-- If account is signed in, display the full name -->
              <template is="dom-if" if="[[item.isSignedIn]]">
                <span>[[item.fullName]]</span>
              </template>
              <!-- Else, display a re-authentication message -->
              <template is="dom-if" if="[[!item.isSignedIn]]">
                <span class="signed-out-text">
                  [[getAccountManagerSignedOutName_(item.unmigrated)]]
                </span>
              </template>

              <div class="secondary">[[item.email]]</div>
            </div>
          </div>

          <template is="dom-if"
              if="[[shouldShowReauthenticationButton_(item)]]">
            <cr-button title="[[getAccountManagerSignedOutTitle_(item)]]"
                class="reauth-button" on-click="onReauthenticationTap_">
              [[getAccountManagerSignedOutLabel_(item.unmigrated)]]
            </cr-button>
          </template>

          <!-- If this is the Device Account, display the management status -->
          <template is="dom-if" if="[[item.isDeviceAccount]]">
            <span class="management-status">
              [[getManagementLabel_(item)]]
            </span>
          </template>
          <!-- Else, display a hamburger menu for removing the account -->
          <template is="dom-if" if="[[!item.isDeviceAccount]]">
            <cr-icon-button class="icon-more-vert"
                title="[[getMoreActionsTitle_(item)]]"
                on-click="onAccountActionsMenuButtonTap_">
            </cr-icon-button>
          </template>
        </div>
      </template>

      <div class="clear settings-box"></div>

      <cr-action-menu>
        <button class="dropdown-item" on-click="onRemoveAccountTap_">
          $i18n{removeAccountLabel}
        </button>
      </cr-action-menu>
    </div>
  </template>
  <script src="account_manager.js"></script>
</dom-module>