Chromium Code Reviews| Index: chrome/install_static/install_util.cc |
| diff --git a/chrome/install_static/install_util.cc b/chrome/install_static/install_util.cc |
| index c31b90e8927cd71f4cedf026d3b44da0f2112046..66694b77508abe0df1e49378e7703348f0ac434f 100644 |
| --- a/chrome/install_static/install_util.cc |
| +++ b/chrome/install_static/install_util.cc |
| @@ -55,6 +55,9 @@ const wchar_t kAppGuidGoogleChrome[] = |
| const wchar_t kAppGuidGoogleBinaries[] = |
| L"{4DC8B4CA-1BDA-483e-B5FA-D3C12E15B62D}"; |
| +const wchar_t kChromeMetrics[] = L"\\MetricsReporting"; |
|
Alexei Svitkine (slow)
2016/08/10 21:49:33
Are just using this for the one sub-key? Seems str
jwd
2016/08/11 21:41:02
Done.
|
| +const wchar_t kChromeStatsSampleKey[] = L"usagestatsinsample"; |
|
Alexei Svitkine (slow)
2016/08/10 21:49:33
I know there's no comments here currently, but ple
jwd
2016/08/11 21:41:02
Done.
|
| + |
| const wchar_t kHeadless[] = L"CHROME_HEADLESS"; |
| const wchar_t kShowRestart[] = L"CHROME_CRASHED"; |
| const wchar_t kRestartInfo[] = L"CHROME_RESTART"; |
| @@ -271,6 +274,17 @@ bool GetCollectStatsConsentImpl(const std::wstring& exe_path) { |
| out_value == 1); |
| } |
| +bool GetCollectStatsInSampleImpl(const std::wstring& exe_path) { |
| + std::wstring registry_path = L"Software\\"; |
|
Alexei Svitkine (slow)
2016/08/10 21:49:33
Seems strange to have this hardcoded. Can this be
jwd
2016/08/11 21:41:02
Done.
|
| + registry_path += GetChromeInstallSubDirectory(); |
| + registry_path += kChromeMetrics; |
| + |
| + DWORD out_value = 0; |
| + return (nt::QueryRegValueDWORD(nt::HKCU, registry_path.c_str(), |
| + kChromeStatsSampleKey, &out_value) && |
| + out_value == 1); |
|
Alexei Svitkine (slow)
2016/08/10 21:49:33
What happens if the registry key isn't set? Would
jwd
2016/08/11 21:41:02
Done.
|
| +} |
| + |
| // Returns true if the |source| string matches the |pattern|. The pattern |
| // may contain wildcards like '?' which matches one character or a '*' |
| // which matches 0 or more characters. |
| @@ -412,6 +426,10 @@ bool GetCollectStatsConsentForTesting(const std::wstring& exe_path) { |
| return GetCollectStatsConsentImpl(exe_path); |
| } |
| +bool GetCollectStatsInSample() { |
| + return GetCollectStatsInSampleImpl(GetCurrentProcessExePath()); |
| +} |
| + |
| bool ReportingIsEnforcedByPolicy(bool* metrics_is_enforced_by_policy) { |
| DWORD value = 0; |