sys_color_change_listener.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // Copyright (c) 2012 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_SYS_COLOR_CHANGE_LISTENER_H_
  5. #define UI_GFX_SYS_COLOR_CHANGE_LISTENER_H_
  6. #include "base/memory/raw_ptr.h"
  7. #include "ui/gfx/gfx_export.h"
  8. namespace gfx {
  9. // Interface for classes that want to listen to system color changes.
  10. class GFX_EXPORT SysColorChangeListener {
  11. public:
  12. virtual void OnSysColorChange() = 0;
  13. protected:
  14. virtual ~SysColorChangeListener() {}
  15. };
  16. // Create an instance of this class in any object that wants to listen
  17. // for system color changes.
  18. class GFX_EXPORT ScopedSysColorChangeListener {
  19. public:
  20. explicit ScopedSysColorChangeListener(SysColorChangeListener* listener);
  21. ScopedSysColorChangeListener(const ScopedSysColorChangeListener&) = delete;
  22. ScopedSysColorChangeListener& operator=(const ScopedSysColorChangeListener&) =
  23. delete;
  24. ~ScopedSysColorChangeListener();
  25. private:
  26. raw_ptr<SysColorChangeListener> listener_;
  27. };
  28. } // namespace gfx;
  29. #endif // UI_GFX_SYS_COLOR_CHANGE_LISTENER_H_