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

Side by Side Diff: chrome/installer/setup/installer_crash_reporter_client.cc

Issue 2422103004: Adding sampling support to installer crash reporter client. (Closed)
Patch Set: Duplicating code :p Created 4 years, 1 month 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 | « chrome/installer/setup/installer_crash_reporter_client.h ('k') | 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/installer/setup/installer_crash_reporter_client.h" 5 #include "chrome/installer/setup/installer_crash_reporter_client.h"
6 6
7 #include "base/debug/crash_logging.h" 7 #include "base/debug/crash_logging.h"
8 #include "base/environment.h" 8 #include "base/environment.h"
9 #include "base/file_version_info.h" 9 #include "base/file_version_info.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "base/path_service.h" 11 #include "base/path_service.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "base/win/registry.h" 13 #include "base/win/registry.h"
14 #include "chrome/common/chrome_paths.h" 14 #include "chrome/common/chrome_paths.h"
15 #include "chrome/common/chrome_version.h" 15 #include "chrome/common/chrome_version.h"
16 #include "chrome/common/env_vars.h" 16 #include "chrome/common/env_vars.h"
17 #include "chrome/install_static/install_util.h"
17 #include "chrome/installer/setup/installer_crash_reporting.h" 18 #include "chrome/installer/setup/installer_crash_reporting.h"
19 #include "chrome/installer/util/browser_distribution.h"
18 #include "chrome/installer/util/google_update_settings.h" 20 #include "chrome/installer/util/google_update_settings.h"
19 21
20 InstallerCrashReporterClient::InstallerCrashReporterClient( 22 InstallerCrashReporterClient::InstallerCrashReporterClient(
21 bool is_per_user_install) 23 bool is_per_user_install)
22 : is_per_user_install_(is_per_user_install) { 24 : is_per_user_install_(is_per_user_install) {
23 } 25 }
24 26
25 InstallerCrashReporterClient::~InstallerCrashReporterClient() = default; 27 InstallerCrashReporterClient::~InstallerCrashReporterClient() = default;
26 28
27 bool InstallerCrashReporterClient::ShouldCreatePipeName( 29 bool InstallerCrashReporterClient::ShouldCreatePipeName(
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 118
117 bool InstallerCrashReporterClient::GetCollectStatsConsent() { 119 bool InstallerCrashReporterClient::GetCollectStatsConsent() {
118 #if defined(GOOGLE_CHROME_BUILD) 120 #if defined(GOOGLE_CHROME_BUILD)
119 return GoogleUpdateSettings::GetCollectStatsConsentAtLevel( 121 return GoogleUpdateSettings::GetCollectStatsConsentAtLevel(
120 !is_per_user_install_); 122 !is_per_user_install_);
121 #else 123 #else
122 return false; 124 return false;
123 #endif 125 #endif
124 } 126 }
125 127
128 bool InstallerCrashReporterClient::GetCollectStatsInSample() {
129 // TODO(grt): remove duplication of code.
130 BrowserDistribution* dist = BrowserDistribution::GetDistribution();
131 base::win::RegKey key(HKEY_CURRENT_USER, dist->GetRegistryPath().c_str(),
132 KEY_QUERY_VALUE | KEY_WOW64_32KEY);
133 if (!key.Valid())
134 return true;
135 DWORD out_value = 0;
136 if (key.ReadValueDW(install_static::kRegValueChromeStatsSample, &out_value) !=
137 ERROR_SUCCESS)
grt (UTC plus 2) 2016/10/25 06:58:31 nit: braces around the body since the conditional
jwd 2016/10/25 20:36:45 Done.
138 return true;
139 return out_value == 1;
140 }
141
126 bool InstallerCrashReporterClient::ReportingIsEnforcedByPolicy(bool* enabled) { 142 bool InstallerCrashReporterClient::ReportingIsEnforcedByPolicy(bool* enabled) {
127 // From the generated policy/policy/policy_constants.cc: 143 // From the generated policy/policy/policy_constants.cc:
128 #if defined(GOOGLE_CHROME_BUILD) 144 #if defined(GOOGLE_CHROME_BUILD)
129 static const wchar_t kRegistryChromePolicyKey[] = 145 static const wchar_t kRegistryChromePolicyKey[] =
130 L"SOFTWARE\\Policies\\Google\\Chrome"; 146 L"SOFTWARE\\Policies\\Google\\Chrome";
131 #else 147 #else
132 static const wchar_t kRegistryChromePolicyKey[] = 148 static const wchar_t kRegistryChromePolicyKey[] =
133 L"SOFTWARE\\Policies\\Chromium"; 149 L"SOFTWARE\\Policies\\Chromium";
134 #endif 150 #endif
135 static const wchar_t kMetricsReportingEnabled[] = L"MetricsReportingEnabled"; 151 static const wchar_t kMetricsReportingEnabled[] = L"MetricsReportingEnabled";
(...skipping 16 matching lines...) Expand all
152 } 168 }
153 } 169 }
154 170
155 return false; 171 return false;
156 } 172 }
157 173
158 bool InstallerCrashReporterClient::EnableBreakpadForProcess( 174 bool InstallerCrashReporterClient::EnableBreakpadForProcess(
159 const std::string& process_type) { 175 const std::string& process_type) {
160 return true; 176 return true;
161 } 177 }
OLDNEW
« no previous file with comments | « chrome/installer/setup/installer_crash_reporter_client.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698