Home | History | Annotate | Download | only in gfx
      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 
      5 #ifndef UI_GFX_SYS_COLOR_CHANGE_LISTENER_H_
      6 #define UI_GFX_SYS_COLOR_CHANGE_LISTENER_H_
      7 
      8 #include "base/basictypes.h"
      9 #include "third_party/skia/include/core/SkColor.h"
     10 #include "ui/gfx/gfx_export.h"
     11 
     12 namespace gfx {
     13 
     14 // Returns true only if Chrome should use an inverted color scheme - which is
     15 // only true if the system has high-contrast mode enabled and and is using a
     16 // light-on-dark color scheme. To be notified when this status changes, use
     17 // ScopedSysColorChangeListener, below.
     18 GFX_EXPORT bool IsInvertedColorScheme();
     19 
     20 // Interface for classes that want to listen to system color changes.
     21 class GFX_EXPORT SysColorChangeListener {
     22  public:
     23   virtual void OnSysColorChange() = 0;
     24 
     25  protected:
     26   virtual ~SysColorChangeListener() {}
     27 };
     28 
     29 // Create an instance of this class in any object that wants to listen
     30 // for system color changes.
     31 class GFX_EXPORT ScopedSysColorChangeListener {
     32  public:
     33   explicit ScopedSysColorChangeListener(SysColorChangeListener* listener);
     34   ~ScopedSysColorChangeListener();
     35 
     36  private:
     37   SysColorChangeListener* listener_;
     38 
     39   DISALLOW_COPY_AND_ASSIGN(ScopedSysColorChangeListener);
     40 };
     41 
     42 }  // namespace gfx;
     43 
     44 #endif  // UI_GFX_SYS_COLOR_CHANGE_LISTENER_H_
     45