caption_style.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // Copyright 2018 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_NATIVE_THEME_CAPTION_STYLE_H_
  5. #define UI_NATIVE_THEME_CAPTION_STYLE_H_
  6. #include "third_party/abseil-cpp/absl/types/optional.h"
  7. #include "third_party/skia/include/core/SkColor.h"
  8. #include "third_party/skia/include/core/SkScalar.h"
  9. #include "ui/native_theme/native_theme_export.h"
  10. #include <string>
  11. namespace ui {
  12. struct NATIVE_THEME_EXPORT CaptionStyle {
  13. CaptionStyle();
  14. CaptionStyle(const CaptionStyle& other);
  15. ~CaptionStyle();
  16. // Returns a CaptionStyle parsed from a specification string, which is a
  17. // serialized JSON object whose keys are strings and whose values are of
  18. // variable types. See the body of this method for details. This is used to
  19. // parse the value of the "--force-caption-style" command-line argument and
  20. // for testing.
  21. static absl::optional<CaptionStyle> FromSpec(const std::string& spec);
  22. // Returns a CaptionStyle populated from the System's Settings.
  23. static absl::optional<CaptionStyle> FromSystemSettings();
  24. // Some or all of these property strings can be empty.
  25. // For example, on Win10 in Settings when a property is set to Default, the
  26. // corresponding string here stays empty. This allows the author styling on
  27. // the webpage to be applied. As the user hasn't specified a preferred style,
  28. // we pass along an empty string from here.
  29. std::string text_color;
  30. std::string background_color;
  31. // Holds text size percentage as a css string.
  32. std::string text_size;
  33. std::string text_shadow;
  34. std::string font_family;
  35. std::string font_variant;
  36. std::string window_color;
  37. std::string window_radius;
  38. };
  39. } // namespace ui
  40. #endif // UI_NATIVE_THEME_CAPTION_STYLE_H_