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

Unified Diff: chrome/installer/util/experiment_storage.cc

Issue 2933043002: Installer support for Windows 10 inactive user toast. (Closed)
Patch Set: review feedback Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/installer/util/experiment_storage.h ('k') | chrome/installer/util/experiment_storage_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/installer/util/experiment_storage.cc
diff --git a/chrome/installer/util/experiment_storage.cc b/chrome/installer/util/experiment_storage.cc
index 6f8fe0e7d1bec16b7ee1b59095f6a02b315cd04b..0fd9d3d73a6d45086ab2a2f4bbb3f8ed976af980 100644
--- a/chrome/installer/util/experiment_storage.cc
+++ b/chrome/installer/util/experiment_storage.cc
@@ -157,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.
@@ -166,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) {
« no previous file with comments | « chrome/installer/util/experiment_storage.h ('k') | chrome/installer/util/experiment_storage_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698