<link rel="import" href="chrome://resources/polymer/v1_0/polymer/polymer.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-a11y-keys-behavior/iron-a11y-keys-behavior.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-flex-layout/classes/iron-flex-layout.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-input/paper-input.html">
<link rel="import" href="chrome://md-settings/controls/settings_checkbox.html">
<link rel="import" href="chrome://md-settings/settings_page/settings_section.html">
<link rel="import" href="user_list.html">

<dom-module id="settings-users-page">
  <link rel="import" type="css" href="chrome://md-settings/settings_shared.css">
  <link rel="import" type="css" href="users_page.css">
  <template>
    <div class="settings-box" i18n-content="usersModifiedByOwnerLabel"
        hidden$="{{computeHideOwnerLabel_(isOwner, isWhitelistManaged)}}">
    </div>
    <div class="settings-box" i18n-content="settingsManagedLabel"
        hidden$="{{computeHideManagedLabel_(isOwner, isWhitelistManaged)}}">
    </div>
    <div class="settings-box">
      <settings-checkbox
          pref="{{prefs.cros.accounts.allowBWSI}}"
          i18n-values="label:guestBrowsingLabel"
          disabled="{{editingDisabled}}">
      </settings-checkbox>
      <settings-checkbox
          pref="{{prefs.cros.accounts.supervisedUsersEnabled}}"
          i18n-values="label:supervisedUsersLabel"
          disabled="{{editingDisabled}}">
      </settings-checkbox>
      <settings-checkbox
          pref="{{prefs.cros.accounts.showUserNamesOnSignIn}}"
          i18n-values="label:showOnSigninLabel"
          disabled="{{editingDisabled}}">
      </settings-checkbox>
    </div>
    <div class="settings-box">
      <settings-checkbox
          pref="{{prefs.cros.accounts.allowGuest}}"
          id="restrictSignIn"
          i18n-values="label:restrictSigninLabel"
          disabled="{{editingDisabled}}" inverted>
      </settings-checkbox>
      <div class="users">
        <div>
          <settings-user-list prefs="[[prefs]]"
              disabled="[[editingUsersDisabled]]">
          </settings-user-list>
        </div>
        <div>
          <paper-input id="addUserInput" i18n-values="label:addUsersLabel"
              disabled="[[editingUsersDisabled]]">
          </paper-input>
          <div class="add-user-button layout horizontal end-justified">
            <paper-button i18n-content="addLabel" on-tap="addUser_"
                disabled="[[editingUsersDisabled]]" raised>
            </paper-button>
          </div>
        </div>
      </div>
    </div>
  </template>
  <script src="users_page.js"></script>
</dom-module>
