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

Side by Side Diff: chrome/browser/profile_resetter/triggered_profile_resetter_win.cc

Issue 2399903002: Switch TriggeredResets to default to On. (Closed)
Patch Set: Created 4 years, 2 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/triggered_profile_resetter.h" 5 #include "chrome/browser/profile_resetter/triggered_profile_resetter.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/metrics/field_trial.h" 9 #include "base/metrics/field_trial.h"
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
(...skipping 16 matching lines...) Expand all
27 // aware of and maintain changes to Chrome's channel logic. 27 // aware of and maintain changes to Chrome's channel logic.
28 const wchar_t kTriggeredResetRegistryPath[] = 28 const wchar_t kTriggeredResetRegistryPath[] =
29 L"Software\\" PRODUCT_NAME L"\\TriggeredReset"; 29 L"Software\\" PRODUCT_NAME L"\\TriggeredReset";
30 30
31 const wchar_t kTriggeredResetToolName[] = L"ToolName"; 31 const wchar_t kTriggeredResetToolName[] = L"ToolName";
32 const wchar_t kTriggeredResetTimestamp[] = L"Timestamp"; 32 const wchar_t kTriggeredResetTimestamp[] = L"Timestamp";
33 33
34 namespace { 34 namespace {
35 35
36 const char kTriggeredResetFieldTrialName[] = "TriggeredResetFieldTrial"; 36 const char kTriggeredResetFieldTrialName[] = "TriggeredResetFieldTrial";
37 const char kTriggeredResetOnGroup[] = "On"; 37 const char kTriggeredResetOffGroup[] = "Off";
38 38
39 bool IsInTriggeredResetFieldTrial() { 39 bool IsDisabledByFieldTrial() {
40 return base::FieldTrialList::FindFullName(kTriggeredResetFieldTrialName) == 40 return base::FieldTrialList::FindFullName(kTriggeredResetFieldTrialName) ==
41 kTriggeredResetOnGroup; 41 kTriggeredResetOffGroup;
42 } 42 }
43 43
44 } // namespace 44 } // namespace
45 45
46 void TriggeredProfileResetter::Activate() { 46 void TriggeredProfileResetter::Activate() {
47 activate_called_ = true; 47 activate_called_ = true;
48 48
49 // System profiles don't contain user settings and bail out if we're not in 49 // System profiles don't contain user settings and bail out if we're not in
50 // the field trial. 50 // the field trial.
51 if (!profile_ || profile_->IsSystemProfile() || 51 if (!profile_ || profile_->IsSystemProfile() || IsDisabledByFieldTrial()) {
52 !IsInTriggeredResetFieldTrial()) {
53 UMA_HISTOGRAM_BOOLEAN("Profile.TriggeredReset", false); 52 UMA_HISTOGRAM_BOOLEAN("Profile.TriggeredReset", false);
54 return; 53 return;
55 } 54 }
56 55
57 int64_t timestamp = 0; 56 int64_t timestamp = 0;
58 base::win::RegKey reset_reg_key(HKEY_CURRENT_USER, 57 base::win::RegKey reset_reg_key(HKEY_CURRENT_USER,
59 kTriggeredResetRegistryPath, KEY_QUERY_VALUE); 58 kTriggeredResetRegistryPath, KEY_QUERY_VALUE);
60 59
61 if (!reset_reg_key.Valid() || 60 if (!reset_reg_key.Valid() ||
62 reset_reg_key.ReadInt64(kTriggeredResetTimestamp, &timestamp) != 61 reset_reg_key.ReadInt64(kTriggeredResetTimestamp, &timestamp) !=
(...skipping 23 matching lines...) Expand all
86 DVLOG(1) << "Failed to read triggered profile reset tool name."; 85 DVLOG(1) << "Failed to read triggered profile reset tool name.";
87 } else if (tool_name_.length() > kMaxToolNameLength) { 86 } else if (tool_name_.length() > kMaxToolNameLength) {
88 tool_name_.resize(kMaxToolNameLength); 87 tool_name_.resize(kMaxToolNameLength);
89 } 88 }
90 89
91 pref_service->SetInt64(prefs::kLastProfileResetTimestamp, timestamp); 90 pref_service->SetInt64(prefs::kLastProfileResetTimestamp, timestamp);
92 } 91 }
93 92
94 UMA_HISTOGRAM_BOOLEAN("Profile.TriggeredReset", has_reset_trigger_); 93 UMA_HISTOGRAM_BOOLEAN("Profile.TriggeredReset", has_reset_trigger_);
95 } 94 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698