OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 // This file contains helper functions which provide information about the | 5 // This file contains helper functions which provide information about the |
6 // current version of Chrome. This includes channel information, version | 6 // current version of Chrome. This includes channel information, version |
7 // information etc. This functionality is provided by using functions in | 7 // information etc. This functionality is provided by using functions in |
8 // kernel32 and advapi32. No other dependencies are allowed in this file. | 8 // kernel32 and advapi32. No other dependencies are allowed in this file. |
9 | 9 |
10 #ifndef CHROME_INSTALL_STATIC_INSTALL_UTIL_H_ | 10 #ifndef CHROME_INSTALL_STATIC_INSTALL_UTIL_H_ |
11 #define CHROME_INSTALL_STATIC_INSTALL_UTIL_H_ | 11 #define CHROME_INSTALL_STATIC_INSTALL_UTIL_H_ |
12 | 12 |
13 #include <string> | 13 #include <string> |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 namespace version_info { | 16 namespace version_info { |
17 enum class Channel; | 17 enum class Channel; |
18 } | 18 } |
19 | 19 |
20 namespace install_static { | 20 namespace install_static { |
21 | 21 |
22 struct InstallConstants; | 22 struct InstallConstants; |
23 | 23 |
24 enum class ProcessType { | |
25 UNINITIALIZED, | |
26 NON_BROWSER_PROCESS, | |
27 BROWSER_PROCESS, | |
28 }; | |
29 | |
30 // Registry key to store the stats/crash sampling state of Chrome. If set to 1, | 24 // Registry key to store the stats/crash sampling state of Chrome. If set to 1, |
31 // stats and crash reports will be uploaded in line with the user's consent, | 25 // stats and crash reports will be uploaded in line with the user's consent, |
32 // otherwise, uploads will be disabled. It is used to sample clients, to reduce | 26 // otherwise, uploads will be disabled. It is used to sample clients, to reduce |
33 // server load for metics and crashes. This is controlled by the | 27 // server load for metics and crashes. This is controlled by the |
34 // MetricsReporting feature in chrome_metrics_services_manager_client.cc and is | 28 // MetricsReporting feature in chrome_metrics_services_manager_client.cc and is |
35 // written when metrics services are started up and when consent changes. | 29 // written when metrics services are started up and when consent changes. |
36 extern const wchar_t kRegValueChromeStatsSample[]; | 30 extern const wchar_t kRegValueChromeStatsSample[]; |
37 | 31 |
38 // TODO(ananta) | 32 // TODO(ananta) |
39 // https://crbug.com/604923 | 33 // https://crbug.com/604923 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 | 141 |
148 // Returns true if if usage stats reporting is controlled by a mandatory | 142 // Returns true if if usage stats reporting is controlled by a mandatory |
149 // policy. |crash_reporting_enabled| determines whether it's enabled (true) or | 143 // policy. |crash_reporting_enabled| determines whether it's enabled (true) or |
150 // disabled (false). | 144 // disabled (false). |
151 bool ReportingIsEnforcedByPolicy(bool* crash_reporting_enabled); | 145 bool ReportingIsEnforcedByPolicy(bool* crash_reporting_enabled); |
152 | 146 |
153 // Initializes |g_process_type| which stores whether or not the current | 147 // Initializes |g_process_type| which stores whether or not the current |
154 // process is the main browser process. | 148 // process is the main browser process. |
155 void InitializeProcessType(); | 149 void InitializeProcessType(); |
156 | 150 |
| 151 // Returns true if the process type is initialized. False otherwise. |
| 152 bool IsProcessTypeInitialized(); |
| 153 |
157 // Returns true if invoked in a Chrome process other than the main browser | 154 // Returns true if invoked in a Chrome process other than the main browser |
158 // process. False otherwise. | 155 // process. False otherwise. |
159 bool IsNonBrowserProcess(); | 156 bool IsNonBrowserProcess(); |
160 | 157 |
| 158 // Returns true if the |process_type| has the rights to access the profile. |
| 159 // False otherwise. |
| 160 bool ProcessNeedsProfileDir(const std::string& process_type); |
| 161 |
161 // Populates |crash_dir| with the crash dump location, respecting modifications | 162 // Populates |crash_dir| with the crash dump location, respecting modifications |
162 // to user-data-dir. | 163 // to user-data-dir. |
163 // TODO(ananta) | 164 // TODO(ananta) |
164 // http://crbug.com/604923 | 165 // http://crbug.com/604923 |
165 // Unify this with the Browser Distribution code. | 166 // Unify this with the Browser Distribution code. |
166 std::wstring GetCrashDumpLocation(); | 167 std::wstring GetCrashDumpLocation(); |
167 | 168 |
168 // Returns the contents of the specified |variable_name| from the environment | 169 // Returns the contents of the specified |variable_name| from the environment |
169 // block of the calling process. Returns an empty string if the variable does | 170 // block of the calling process. Returns an empty string if the variable does |
170 // not exist. | 171 // not exist. |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 // the installer. |update_ap|, if not null, is set to the raw "ap" value read | 247 // the installer. |update_ap|, if not null, is set to the raw "ap" value read |
247 // from Chrome's ClientState key in the registry. |update_cohort_name|, if not | 248 // from Chrome's ClientState key in the registry. |update_cohort_name|, if not |
248 // null, is set to the raw "cohort\name" value read from Chrome's ClientState | 249 // null, is set to the raw "cohort\name" value read from Chrome's ClientState |
249 // key in the registry. | 250 // key in the registry. |
250 std::wstring DetermineChannel(const InstallConstants& mode, | 251 std::wstring DetermineChannel(const InstallConstants& mode, |
251 bool system_level, | 252 bool system_level, |
252 bool from_binaries, | 253 bool from_binaries, |
253 std::wstring* update_ap, | 254 std::wstring* update_ap, |
254 std::wstring* update_cohort_name); | 255 std::wstring* update_cohort_name); |
255 | 256 |
256 // Caches the |ProcessType| of the current process. | |
257 extern ProcessType g_process_type; | |
258 | |
259 } // namespace install_static | 257 } // namespace install_static |
260 | 258 |
261 #endif // CHROME_INSTALL_STATIC_INSTALL_UTIL_H_ | 259 #endif // CHROME_INSTALL_STATIC_INSTALL_UTIL_H_ |
OLD | NEW |