Index: chrome/installer/util/experiment_storage.cc |
diff --git a/chrome/installer/util/experiment_storage.cc b/chrome/installer/util/experiment_storage.cc |
index 403d860d4b2744d44fa8d08133728564a09c24b3..bdfa3f8ba80d7c0dc8cd879ad8364b7dc71f390e 100644 |
--- a/chrome/installer/util/experiment_storage.cc |
+++ b/chrome/installer/util/experiment_storage.cc |
@@ -36,7 +36,7 @@ namespace installer { |
namespace { |
constexpr base::char16 kExperimentLabelName[] = L"CrExp60"; |
-constexpr wchar_t kRegKeyRetention[] = L"Retention"; |
+constexpr wchar_t kRegKeyRetention[] = L"\\Retention"; |
constexpr wchar_t kRegValueActionDelay[] = L"ActionDelay"; |
constexpr wchar_t kRegValueFirstDisplayTime[] = L"FirstDisplayTime"; |
constexpr wchar_t kRegValueGroup[] = L"Group"; |
@@ -91,7 +91,6 @@ bool GetExperimentStateKeyPath(bool system_level, base::string16* path) { |
base::string16 user_sid; |
if (base::win::GetUserSidString(&user_sid)) { |
*path = install_details.GetClientStateMediumKeyPath() |
Patrick Monette
2017/06/13 19:13:40
Looks weird at first glance. Why not also move the
grt (UTC plus 2)
2017/06/14 20:43:44
Acknowledged.
|
- .append(L"\\") |
.append(kRegKeyRetention) |
.append(L"\\") |
.append(user_sid); |
@@ -158,7 +157,7 @@ ExperimentStorage::Lock::~Lock() { |
DCHECK(result); |
} |
-bool ExperimentStorage::Lock::ReadParticipation(Participation* participation) { |
+bool ExperimentStorage::Lock::ReadParticipation(Study* participation) { |
base::win::RegKey key; |
// A failure to open the key likely indicates that this isn't running from a |
// real install of Chrome. |
@@ -167,28 +166,29 @@ bool ExperimentStorage::Lock::ReadParticipation(Participation* participation) { |
DWORD value = 0; |
LONG result = key.ReadValueDW(kRegValueRetentionStudy, &value); |
- if (result != ERROR_SUCCESS) { |
- // This likely means that the value is not present. |
- *participation = Participation::kNotEvaluated; |
- } else if (value == 0) { |
- *participation = Participation::kNotParticipating; |
- } else { |
- *participation = Participation::kIsParticipating; |
- } |
+ // An error most likely means that the value is not present. |
+ if (result != ERROR_SUCCESS || value == 0) |
+ *participation = kNoStudySelected; |
+ else if (value == 1) |
+ *participation = kStudyOne; |
+ else |
+ *participation = kStudyTwo; |
return true; |
} |
-bool ExperimentStorage::Lock::WriteParticipation(Participation participation) { |
+bool ExperimentStorage::Lock::WriteParticipation(Study participation) { |
+ DCHECK(participation == kNoStudySelected || participation == kStudyOne || |
+ participation == kStudyTwo); |
base::win::RegKey key; |
// A failure to open the key likely indicates that this isn't running from a |
// real install of Chrome. |
if (!OpenParticipationKey(true /* write_access */, &key)) |
return false; |
- if (participation == Participation::kNotEvaluated) |
+ if (participation == kNoStudySelected) |
return key.DeleteValue(kRegValueRetentionStudy) == ERROR_SUCCESS; |
- const DWORD value = participation == Participation::kIsParticipating ? 1 : 0; |
- return key.WriteValue(kRegValueRetentionStudy, value) == ERROR_SUCCESS; |
+ return key.WriteValue(kRegValueRetentionStudy, participation) == |
+ ERROR_SUCCESS; |
} |
bool ExperimentStorage::Lock::LoadExperiment(Experiment* experiment) { |