scoped_preferred_scroller_style_mac.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // Copyright 2016 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_BASE_TEST_SCOPED_PREFERRED_SCROLLER_STYLE_MAC_H_
  5. #define UI_BASE_TEST_SCOPED_PREFERRED_SCROLLER_STYLE_MAC_H_
  6. #include <memory>
  7. namespace base {
  8. namespace mac {
  9. class ScopedObjCClassSwizzler;
  10. }
  11. }
  12. namespace ui {
  13. namespace test {
  14. // Overrides system setting for scrollbar style with NSScrollerOverlay if we
  15. // want the scrollbar to overlay. Otherwise, override with
  16. // NSScrollerStyleLegacy which means "always show scrollbars".
  17. class ScopedPreferredScrollerStyle {
  18. public:
  19. explicit ScopedPreferredScrollerStyle(bool overlay);
  20. ScopedPreferredScrollerStyle(const ScopedPreferredScrollerStyle&) = delete;
  21. ScopedPreferredScrollerStyle& operator=(const ScopedPreferredScrollerStyle&) =
  22. delete;
  23. ~ScopedPreferredScrollerStyle();
  24. private:
  25. std::unique_ptr<base::mac::ScopedObjCClassSwizzler> swizzler_;
  26. // True if the scrollbar style should overlay.
  27. bool overlay_;
  28. };
  29. } // namespace test
  30. } // namespace ui
  31. #endif // UI_BASE_TEST_SCOPED_PREFERRED_SCROLLER_STYLE_MAC_H_