Chromium Code Reviews| 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/win/registry.h" | 8 #include "base/win/registry.h" |
| 9 #include "chrome/browser/themes/theme_service.h" | 9 #include "chrome/browser/themes/theme_service.h" |
| 10 | 10 |
| 11 // 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 // are relevant to earlier versions of Windows. | |
|
Peter Kasting
2016/12/01 06:19:04
Should this be renamed ThemeServiceWin10 then?
No
Bret
2016/12/08 00:16:07
I think the name is okay, since it's an OS-specifi
Peter Kasting
2016/12/08 00:24:50
Fixing Win 7 basic seems worth doing; that's used
| |
| 11 class ThemeServiceWin : public ThemeService { | 14 class ThemeServiceWin : public ThemeService { |
| 12 public: | 15 public: |
| 13 ThemeServiceWin(); | 16 ThemeServiceWin(); |
| 14 ~ThemeServiceWin() override; | 17 ~ThemeServiceWin() override; |
| 15 | 18 |
| 16 private: | 19 private: |
| 17 // ThemeService: | 20 // ThemeService: |
| 18 bool ShouldUseNativeFrame() const override; | 21 bool ShouldUseNativeFrame() const override; |
| 19 SkColor GetDefaultColor(int id, bool incognito) const override; | 22 SkColor GetDefaultColor(int id, bool incognito) const override; |
| 20 | 23 |
| 21 // Returns true if the window frame color is determined by the DWM, i.e. this | 24 // Returns true if colors from DWM can be used, i.e. this is a native frame |
| 22 // is a native frame on Windows 10. | 25 // on Windows 10. |
| 23 bool ShouldUseDwmFrameColor() const; | 26 bool DwmColorsAllowed() const; |
| 24 | 27 |
| 25 // Callback executed when |dwm_key_| is updated. This re-reads the active | 28 // Callback executed when |dwm_key_| is updated. This re-reads the active |
| 26 // frame color and updates |dwm_frame_color_|. | 29 // frame color and updates |dwm_frame_color_|. |
| 27 void OnDwmKeyUpdated(); | 30 void OnDwmKeyUpdated(); |
| 28 | 31 |
| 29 // Registry key containing the params that determine the DWM frame color. | 32 // Registry key containing the params that determine the DWM frame color. |
| 30 // This is only initialized on Windows 10. | |
| 31 std::unique_ptr<base::win::RegKey> dwm_key_; | 33 std::unique_ptr<base::win::RegKey> dwm_key_; |
| 32 | 34 |
| 33 // The DWM frame color, if available; white otherwise. | 35 // True if the frame should be colored using the DWM values here. False if the |
| 36 // default frame colors should be used instead. | |
| 37 bool use_dwm_frame_color_; | |
|
Peter Kasting
2016/12/01 06:19:04
Maybe instead of this bool, use a base::Optional<S
Bret
2016/12/08 00:16:07
I don't quite understand what you mean here. Do yo
Peter Kasting
2016/12/08 00:24:50
My intent was that this class is only used to repo
Bret
2016/12/08 02:16:59
Oh okay I see what you mean now. I don't think the
Peter Kasting
2016/12/08 04:59:47
Hmm. I know we'd probably have to write some simi
| |
| 38 | |
| 39 // The frame color when active. | |
| 34 SkColor dwm_frame_color_; | 40 SkColor dwm_frame_color_; |
| 35 | 41 |
| 42 // The frame color when inactive. | |
| 43 SkColor dwm_inactive_frame_color_; | |
| 44 | |
| 36 // The DWM accent border color, if available; white otherwise. | 45 // The DWM accent border color, if available; white otherwise. |
| 37 SkColor dwm_accent_border_color_; | 46 SkColor dwm_accent_border_color_; |
| 38 | 47 |
| 39 DISALLOW_COPY_AND_ASSIGN(ThemeServiceWin); | 48 DISALLOW_COPY_AND_ASSIGN(ThemeServiceWin); |
| 40 }; | 49 }; |
| 41 | 50 |
| 42 #endif // CHROME_BROWSER_THEMES_THEME_SERVICE_WIN_H_ | 51 #endif // CHROME_BROWSER_THEMES_THEME_SERVICE_WIN_H_ |
| OLD | NEW |