<link rel="import" href="chrome://resources/cr_elements/cr_slider/cr_slider.html">
<link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-radio-button/paper-radio-button.html">
<link rel="import" href="/controls/settings_checkbox.html">
<link rel="import" href="/controls/settings_radio_group.html">
<link rel="import" href="/device_page/device_page_browser_proxy.html">
<link rel="import" href="/settings_shared_css.html">

<dom-module id="settings-pointers">
  <template>
    <style include="settings-shared">
      .subsection > * {
        -webkit-padding-end: 20px;
        -webkit-padding-start: 56px;
      }

      .subsection h2 {
        padding: 0 20px;
      }
    </style>
    <div id="mouse" hidden$="[[!hasMouse]]"
        class$="[[getSectionClass_(hasMouse, hasTouchpad)]]">
      <!-- Subsection title only appears if both mouse and touchpad exist. -->
      <h2 hidden$="[[!hasTouchpad]]">$i18n{mouseTitle}</h2>
      <div class="settings-box first">
        <settings-checkbox pref="{{prefs.settings.mouse.primary_right}}"
            label="$i18n{mouseSwapButtons}">
        </settings-checkbox>
      </div>
      <div class="settings-box">
        <div class="start" id="mouseSpeedLabel">$i18n{mouseSpeed}</div>
        <div class="layout horizontal center">
          <div>$i18n{pointerSlow}</div>
          <cr-slider class="always-on" snaps
              value="{{prefs.settings.mouse.sensitivity2.value}}"
              tick-values="[[sensitivityValues_]]"
              aria-labelledby="mouseSpeedLabel">
          </cr-slider>
          <div>$i18n{pointerFast}</div>
        </div>
      </div>
    </div>
    <div id="touchpad" hidden$="[[!hasTouchpad]]"
        class$="[[getSectionClass_(hasMouse, hasTouchpad)]]">
      <!-- Subsection title only appears if both mouse and touchpad exist. -->
      <h2 hidden$="[[!hasMouse]]">$i18n{touchpadTitle}</h2>
      <div class="settings-box block first">
        <settings-checkbox id="enableTapToClick"
            pref="{{prefs.settings.touchpad.enable_tap_to_click}}"
            label="$i18n{touchpadTapToClickEnabledLabel}">
        </settings-checkbox>
        <settings-checkbox id="enableTapDragging"
            pref="{{prefs.settings.touchpad.enable_tap_dragging}}"
            label="$i18n{tapDraggingLabel}">
        </settings-checkbox>
      </div>
      <div class="settings-box">
        <div class="start" id="touchpadSpeedLabel">$i18n{touchpadSpeed}</div>
        <div class="layout horizontal center">
          <div>$i18n{pointerSlow}</div>
          <cr-slider id="touchpadSensitivity" class="always-on" snaps
              value="{{prefs.settings.touchpad.sensitivity2.value}}"
              tick-values="[[sensitivityValues_]]"
              aria-labelledby="touchpadSpeedLabel">
          </cr-slider>
          <div>$i18n{pointerFast}</div>
        </div>
      </div>
      <div class="settings-box">$i18n{scrollLabel}</div>
      <div class="list-frame">
        <settings-radio-group pref="{{prefs.settings.touchpad.natural_scroll}}">
          <paper-radio-button name="false">
            $i18n{traditionalScrollLabel}
          </paper-radio-button>
          <paper-radio-button name="true">
            $i18n{naturalScrollLabel}
            <a href="$i18n{naturalScrollLearnMoreLink}" target="_blank"
                on-tap="onLearnMoreLinkActivated_"
                on-keydown="onLearnMoreLinkActivated_">
              $i18n{naturalScrollLearnMore}
            </a>
          </paper-radio-button>
        </settings-radio-group>
      </div>
    </div>
  </template>
  <script src="pointers.js"></script>
</dom-module>
