extension_set.h 981 B

1234567891011121314151617181920212223242526272829303132
  1. // Copyright 2017 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 UI_GFX_EXTENSION_SET_H_
  5. #define UI_GFX_EXTENSION_SET_H_
  6. #include "base/containers/flat_set.h"
  7. #include "base/strings/string_piece.h"
  8. #include "ui/gfx/gfx_export.h"
  9. namespace gfx {
  10. using ExtensionSet = base::flat_set<base::StringPiece>;
  11. GFX_EXPORT ExtensionSet
  12. MakeExtensionSet(const base::StringPiece& extensions_string);
  13. GFX_EXPORT bool HasExtension(const ExtensionSet& extension_set,
  14. const base::StringPiece& extension);
  15. template <size_t N>
  16. inline bool HasExtension(const ExtensionSet& extension_set,
  17. const char (&extension)[N]) {
  18. return HasExtension(extension_set, base::StringPiece(extension, N - 1));
  19. }
  20. GFX_EXPORT std::string MakeExtensionString(const ExtensionSet& extension_set);
  21. } // namespace gfx
  22. #endif // UI_GFX_EXTENSION_SET_H_