OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/profile_resetter/automatic_profile_resetter.h" | 5 #include "chrome/browser/profile_resetter/automatic_profile_resetter.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 | 78 |
79 // Number of bits, and maximum value (exclusive) for the mask whose bits | 79 // Number of bits, and maximum value (exclusive) for the mask whose bits |
80 // indicate if any of reset criteria were satisfied, and which of the mementos | 80 // indicate if any of reset criteria were satisfied, and which of the mementos |
81 // were already present. | 81 // were already present. |
82 const size_t kCombinedStatusMaskNumberOfBits = 4u; | 82 const size_t kCombinedStatusMaskNumberOfBits = 4u; |
83 const uint32 kCombinedStatusMaskMaximumValue = | 83 const uint32 kCombinedStatusMaskMaximumValue = |
84 (1u << kCombinedStatusMaskNumberOfBits); | 84 (1u << kCombinedStatusMaskNumberOfBits); |
85 | 85 |
86 // Returns whether or not a dry-run shall be performed. | 86 // Returns whether or not a dry-run shall be performed. |
87 bool ShouldPerformDryRun() { | 87 bool ShouldPerformDryRun() { |
88 return base::StartsWithASCII( | 88 return base::StartsWith( |
89 base::FieldTrialList::FindFullName(kAutomaticProfileResetStudyName), | 89 base::FieldTrialList::FindFullName(kAutomaticProfileResetStudyName), |
90 kAutomaticProfileResetStudyDryRunGroupName, true); | 90 kAutomaticProfileResetStudyDryRunGroupName, base::CompareCase::SENSITIVE); |
91 } | 91 } |
92 | 92 |
93 // Returns whether or not a live-run shall be performed. | 93 // Returns whether or not a live-run shall be performed. |
94 bool ShouldPerformLiveRun() { | 94 bool ShouldPerformLiveRun() { |
95 return base::StartsWithASCII( | 95 return base::StartsWith( |
96 base::FieldTrialList::FindFullName(kAutomaticProfileResetStudyName), | 96 base::FieldTrialList::FindFullName(kAutomaticProfileResetStudyName), |
97 kAutomaticProfileResetStudyEnabledGroupName, true); | 97 kAutomaticProfileResetStudyEnabledGroupName, |
| 98 base::CompareCase::SENSITIVE); |
98 } | 99 } |
99 | 100 |
100 // If the currently active experiment group prescribes a |program| and | 101 // If the currently active experiment group prescribes a |program| and |
101 // |hash_seed| to use instead of the baked-in ones, retrieves those and returns | 102 // |hash_seed| to use instead of the baked-in ones, retrieves those and returns |
102 // true. Otherwise, returns false. | 103 // true. Otherwise, returns false. |
103 bool GetProgramAndHashSeedOverridesFromExperiment(std::string* program, | 104 bool GetProgramAndHashSeedOverridesFromExperiment(std::string* program, |
104 std::string* hash_seed) { | 105 std::string* hash_seed) { |
105 DCHECK(program); | 106 DCHECK(program); |
106 DCHECK(hash_seed); | 107 DCHECK(hash_seed); |
107 #if defined(GOOGLE_CHROME_BUILD) | 108 #if defined(GOOGLE_CHROME_BUILD) |
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
754 | 755 |
755 void AutomaticProfileResetter::FinishResetPromptFlow() { | 756 void AutomaticProfileResetter::FinishResetPromptFlow() { |
756 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 757 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
757 DCHECK(state_ == STATE_HAS_TRIGGERED_PROMPT || | 758 DCHECK(state_ == STATE_HAS_TRIGGERED_PROMPT || |
758 state_ == STATE_HAS_SHOWN_BUBBLE || | 759 state_ == STATE_HAS_SHOWN_BUBBLE || |
759 state_ == STATE_PERFORMING_RESET); | 760 state_ == STATE_PERFORMING_RESET); |
760 DCHECK(!evaluation_results_); | 761 DCHECK(!evaluation_results_); |
761 | 762 |
762 state_ = STATE_DONE; | 763 state_ = STATE_DONE; |
763 } | 764 } |
OLD | NEW |