Chromium Code Reviews| Index: chrome/install_static/install_util.cc |
| diff --git a/chrome/install_static/install_util.cc b/chrome/install_static/install_util.cc |
| index 633e8e0ac73ebb5797f91180cd84c895acd6c2d2..bdfe518515372595c82bb57ccf9b513103f4c5c6 100644 |
| --- a/chrome/install_static/install_util.cc |
| +++ b/chrome/install_static/install_util.cc |
| @@ -350,16 +350,13 @@ bool GetCollectStatsInSample() { |
| bool SetCollectStatsInSample(bool in_sample) { |
| std::wstring registry_path = GetChromeInstallRegistryPath(); |
| - HANDLE key_handle = INVALID_HANDLE_VALUE; |
| - if (!nt::CreateRegKey(nt::HKCU, registry_path.c_str(), |
| - KEY_SET_VALUE | KEY_WOW64_32KEY, &key_handle)) { |
| + nt::ScopedHANDLE key = nt::CreateRegKey(nt::HKCU, registry_path.c_str(), |
| + KEY_SET_VALUE | KEY_WOW64_32KEY); |
| + if (!key.is_valid()) |
|
grt (UTC plus 2)
2017/02/08 21:44:02
wdyt of an explicit operator bool so this can be w
|
| return false; |
| - } |
| - bool success = nt::SetRegValueDWORD(key_handle, kRegValueChromeStatsSample, |
| - in_sample ? 1 : 0); |
| - nt::CloseRegKey(key_handle); |
| - return success; |
| + return nt::SetRegValueDWORD(key.get(), kRegValueChromeStatsSample, |
|
grt (UTC plus 2)
2017/02/08 21:44:02
i think that
return key.SetRegValueDWORD(...);
i
|
| + in_sample ? 1 : 0); |
| } |
| // Appends "[kCompanyPathName\]kProductPathName[install_suffix]" to |path|, |