Chromium Code Reviews| Index: chrome/installer/mini_installer/mini_installer.cc |
| diff --git a/chrome/installer/mini_installer/mini_installer.cc b/chrome/installer/mini_installer/mini_installer.cc |
| index 50b6252041a5926f9f29416ac949d3ea63026c11..fe3423f0d9f939de09aaec9440b3a7694fbafbf1 100644 |
| --- a/chrome/installer/mini_installer/mini_installer.cc |
| +++ b/chrome/installer/mini_installer/mini_installer.cc |
| @@ -59,11 +59,14 @@ struct Context { |
| PathString* setup_resource_path; |
| }; |
| +// TODO(grt): Frame this in terms of whether or not the brand supports |
| +// integation with Omaha, where Google Update is the Google-specific fork of |
| +// the open-source Omaha project. |
| #if defined(GOOGLE_CHROME_BUILD) |
| // Opens the Google Update ClientState key. If |binaries| is false, opens the |
| // key for Google Chrome or Chrome SxS (canary). If |binaries| is true and an |
| // existing multi-install Chrome is being updated, opens the key for the |
| -// binaries; otherwise, returns false. |
| +// multi-install binaries; otherwise, returns false. |
| bool OpenInstallStateKey(const Configuration& configuration, |
| bool binaries, |
| RegKey* key) { |
| @@ -91,10 +94,11 @@ void WriteInstallResults(const Configuration& configuration, |
| // Write the value in Chrome ClientState key and in the binaries' if an |
| // existing multi-install Chrome is being updated. |
| - for (int i = 0; i < 2; ++i) { |
| + static constexpr bool kValues[] = {false, true}; |
| + for (bool binaries : kValues) { |
|
grt (UTC plus 2)
2017/02/02 08:16:48
i get this compile error:
mini_installer.cc(122):
huangs
2017/02/02 16:06:03
Ah interesting. It seems this requires
#include <
grt (UTC plus 2)
2017/02/03 07:45:47
Sweet! Thanks for the tip!
|
| RegKey key; |
| DWORD value; |
| - if (OpenInstallStateKey(configuration, i != 0, &key)) { |
| + if (OpenInstallStateKey(configuration, binaries, &key)) { |
| if (key.ReadDWValue(kInstallerResultRegistryValue, &value) != |
| ERROR_SUCCESS || |
| value == 0) { |
| @@ -115,9 +119,10 @@ void WriteInstallResults(const Configuration& configuration, |
| void SetInstallerFlags(const Configuration& configuration) { |
| StackString<128> value; |
| - for (int i = 0; i < 2; ++i) { |
| + static constexpr bool kValues[] = {false, true}; |
| + for (bool binaries : kValues) { |
| RegKey key; |
| - if (!OpenInstallStateKey(configuration, i != 0, &key)) |
| + if (!OpenInstallStateKey(configuration, binaries, &key)) |
| continue; |
| LONG ret = key.ReadSZValue(kApRegistryValue, value.get(), value.capacity()); |