| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_THEMES_THEME_SERVICE_WIN_H_ | 5 #ifndef CHROME_BROWSER_THEMES_THEME_SERVICE_WIN_H_ |
| 6 #define CHROME_BROWSER_THEMES_THEME_SERVICE_WIN_H_ | 6 #define CHROME_BROWSER_THEMES_THEME_SERVICE_WIN_H_ |
| 7 | 7 |
| 8 #include "base/optional.h" |
| 8 #include "base/win/registry.h" | 9 #include "base/win/registry.h" |
| 9 #include "chrome/browser/themes/theme_service.h" | 10 #include "chrome/browser/themes/theme_service.h" |
| 10 | 11 |
| 11 // Tracks updates to the native colors on Windows 10 and calcuates the values we | 12 // Tracks updates to the native colors on Windows 10 and calcuates the values we |
| 12 // should use (which are not always what Windows uses). None of the values here | 13 // should use (which are not always what Windows uses). None of the values here |
| 13 // are relevant to earlier versions of Windows. | 14 // are relevant to earlier versions of Windows. |
| 14 class ThemeServiceWin : public ThemeService { | 15 class ThemeServiceWin : public ThemeService { |
| 15 public: | 16 public: |
| 16 ThemeServiceWin(); | 17 ThemeServiceWin(); |
| 17 ~ThemeServiceWin() override; | 18 ~ThemeServiceWin() override; |
| 18 | 19 |
| 19 private: | 20 private: |
| 20 // ThemeService: | 21 // ThemeService: |
| 21 bool ShouldUseNativeFrame() const override; | 22 bool ShouldUseNativeFrame() const override; |
| 22 SkColor GetDefaultColor(int id, bool incognito) const override; | 23 SkColor GetDefaultColor(int id, bool incognito) const override; |
| 23 | 24 |
| 24 // Returns true if colors from DWM can be used, i.e. this is a native frame | 25 // Returns true if colors from DWM can be used, i.e. this is a native frame |
| 25 // on Windows 10. | 26 // on Windows 10. |
| 26 bool DwmColorsAllowed() const; | 27 bool DwmColorsAllowed() const; |
| 27 | 28 |
| 28 // Callback executed when |dwm_key_| is updated. This re-reads the active | 29 // Callback executed when |dwm_key_| is updated. This re-reads the active |
| 29 // frame color and updates |use_dwm_frame_color_|, |dwm_frame_color_| and | 30 // frame color and updates |use_dwm_frame_color_|, |dwm_frame_color_| and |
| 30 // |dwm_inactive_frame_color_|. | 31 // |dwm_inactive_frame_color_|. |
| 31 void OnDwmKeyUpdated(); | 32 void OnDwmKeyUpdated(); |
| 32 | 33 |
| 33 // Registry key containing the params that determine the DWM frame color. | 34 // Registry key containing the params that determine the DWM frame color. |
| 34 std::unique_ptr<base::win::RegKey> dwm_key_; | 35 std::unique_ptr<base::win::RegKey> dwm_key_; |
| 35 | 36 |
| 36 // True if the frame should be colored using the DWM values here. False if the | 37 // The frame color when active. If empty the default colors should be used. |
| 37 // default frame colors should be used instead. | 38 base::Optional<SkColor> dwm_frame_color_; |
| 38 bool use_dwm_frame_color_; | |
| 39 | 39 |
| 40 // The frame color when active. | 40 // True if we took dwm_inactive_frame_color_ from the registry (vs calculating |
| 41 SkColor dwm_frame_color_; | 41 // it ourselves) and thus Windows will use it too. |
| 42 bool inactive_frame_color_from_registry_; |
| 42 | 43 |
| 43 // The frame color when inactive. | 44 // The frame color when inactive. If empty the default colors should be used. |
| 44 SkColor dwm_inactive_frame_color_; | 45 base::Optional<SkColor> dwm_inactive_frame_color_; |
| 45 | 46 |
| 46 // The DWM accent border color, if available; white otherwise. | 47 // The DWM accent border color, if available; white otherwise. |
| 47 SkColor dwm_accent_border_color_; | 48 SkColor dwm_accent_border_color_; |
| 48 | 49 |
| 49 DISALLOW_COPY_AND_ASSIGN(ThemeServiceWin); | 50 DISALLOW_COPY_AND_ASSIGN(ThemeServiceWin); |
| 50 }; | 51 }; |
| 51 | 52 |
| 52 #endif // CHROME_BROWSER_THEMES_THEME_SERVICE_WIN_H_ | 53 #endif // CHROME_BROWSER_THEMES_THEME_SERVICE_WIN_H_ |
| OLD | NEW |