Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Side by Side Diff: chrome/browser/themes/theme_service_win.cc

Issue 1822263002: Fix DCHECK failure on bots when registry key can't be opened successfully. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "chrome/browser/themes/theme_service_win.h" 5 #include "chrome/browser/themes/theme_service_win.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/win/windows_version.h" 8 #include "base/win/windows_version.h"
9 #include "chrome/browser/themes/theme_properties.h" 9 #include "chrome/browser/themes/theme_properties.h"
10 #include "grit/theme_resources.h" 10 #include "grit/theme_resources.h"
11 #include "skia/ext/skia_utils_win.h" 11 #include "skia/ext/skia_utils_win.h"
12 #include "ui/base/win/shell.h" 12 #include "ui/base/win/shell.h"
13 13
14 ThemeServiceWin::ThemeServiceWin() { 14 ThemeServiceWin::ThemeServiceWin() {
15 // This just checks for Windows 10 instead of calling ShouldUseDwmFrameColor() 15 // This just checks for Windows 10 instead of calling ShouldUseDwmFrameColor()
16 // because we want to monitor the frame color even when a custom frame is in 16 // because we want to monitor the frame color even when a custom frame is in
17 // use, so that it will be correct if at any time the user switches to the 17 // use, so that it will be correct if at any time the user switches to the
18 // native frame. 18 // native frame.
19 if (base::win::GetVersion() >= base::win::VERSION_WIN10) { 19 if (base::win::GetVersion() >= base::win::VERSION_WIN10) {
20 dwm_key_.reset(new base::win::RegKey( 20 dwm_key_.reset(new base::win::RegKey(
21 HKEY_CURRENT_USER, L"SOFTWARE\\Microsoft\\Windows\\DWM", KEY_READ)); 21 HKEY_CURRENT_USER, L"SOFTWARE\\Microsoft\\Windows\\DWM", KEY_READ));
22 OnDwmKeyUpdated(); 22 if (dwm_key_->Valid())
23 OnDwmKeyUpdated();
24 else
25 dwm_key_.reset();
23 } 26 }
24 } 27 }
25 28
26 ThemeServiceWin::~ThemeServiceWin() { 29 ThemeServiceWin::~ThemeServiceWin() {
27 } 30 }
28 31
29 bool ThemeServiceWin::ShouldUseNativeFrame() const { 32 bool ThemeServiceWin::ShouldUseNativeFrame() const {
30 return !HasCustomImage(IDR_THEME_FRAME) && ui::win::IsAeroGlassEnabled(); 33 return !HasCustomImage(IDR_THEME_FRAME) && ui::win::IsAeroGlassEnabled();
31 } 34 }
32 35
(...skipping 25 matching lines...) Expand all
58 (color_prevalence == 1) && 61 (color_prevalence == 1) &&
59 (dwm_key_->ReadValueDW(L"AccentColor", &accent_color) == ERROR_SUCCESS)) 62 (dwm_key_->ReadValueDW(L"AccentColor", &accent_color) == ERROR_SUCCESS))
60 ? skia::COLORREFToSkColor(accent_color) 63 ? skia::COLORREFToSkColor(accent_color)
61 : SK_ColorWHITE; 64 : SK_ColorWHITE;
62 65
63 // Watch for future changes. 66 // Watch for future changes.
64 if (!dwm_key_->StartWatching(base::Bind( 67 if (!dwm_key_->StartWatching(base::Bind(
65 &ThemeServiceWin::OnDwmKeyUpdated, base::Unretained(this)))) 68 &ThemeServiceWin::OnDwmKeyUpdated, base::Unretained(this))))
66 dwm_key_.reset(); 69 dwm_key_.reset();
67 } 70 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698