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

ash / public / cpp / keyboard / keyboard_config.h [blame]

// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef ASH_PUBLIC_CPP_KEYBOARD_KEYBOARD_CONFIG_H_
#define ASH_PUBLIC_CPP_KEYBOARD_KEYBOARD_CONFIG_H_

#include <tuple>

#include "ash/public/cpp/ash_public_export.h"

namespace keyboard {

// Determines how the keyboard overscroll enabled state is set.
enum class KeyboardOverscrollBehavior {
  // Use the default behavior.
  kDefault,

  // Enable keyboard overscroll if allowed.
  kEnabled,

  // Do not enable keyboard overscroll.
  kDisabled,
};

struct KeyboardConfig {
  // Whether the virtual keyboard can provide auto-complete.
  bool auto_complete = true;

  // Whether the virtual keyboard can provide auto-correct.
  bool auto_correct = true;

  // Whether the virtual keyboard can provide auto-capitalization.
  bool auto_capitalize = true;

  // Whether the virtual keyboard can provide input via handwriting recognition.
  bool handwriting = true;

  // Whether the virtual keyboard can provide spell-check.
  bool spell_check = true;

  // Whether the virtual keyboard can provide voice input.
  bool voice_input = true;

  // Whether overscroll is currently allowed by the active keyboard container.
  KeyboardOverscrollBehavior overscroll_behavior =
      KeyboardOverscrollBehavior::kDefault;

  bool operator==(const KeyboardConfig& other) const {
    return std::tie(auto_complete, auto_correct, auto_capitalize, handwriting,
                    spell_check, voice_input, overscroll_behavior) ==
           std::tie(other.auto_complete, other.auto_correct,
                    other.auto_capitalize, other.handwriting, other.spell_check,
                    other.voice_input, other.overscroll_behavior);
  }

  bool operator!=(const KeyboardConfig& other) const {
    return !(*this == other);
  }
};

}  // namespace keyboard

#endif  // ASH_PUBLIC_CPP_KEYBOARD_KEYBOARD_CONFIG_H_