title_validator.h 798 B

12345678910111213141516171819202122
  1. // Copyright 2021 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef COMPONENTS_CONTINUOUS_SEARCH_COMMON_TITLE_VALIDATOR_H_
  5. #define COMPONENTS_CONTINUOUS_SEARCH_COMMON_TITLE_VALIDATOR_H_
  6. #include "base/strings/string_piece.h"
  7. namespace continuous_search {
  8. // These methods:
  9. // 1. Replace control characters with whitespace.
  10. // 2. Trim leading and trailing whitespace.
  11. // 3. Collapse internal whitespace to a single space.
  12. // 4. Cap the length of the output at `kMaxLength`.
  13. std::string ValidateTitleAscii(base::StringPiece title);
  14. std::u16string ValidateTitle(base::StringPiece16 title);
  15. } // namespace continuous_search
  16. #endif // COMPONENTS_CONTINUOUS_SEARCH_COMMON_TITLE_VALIDATOR_H_