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 // This file contains helper functions which provide information about the | 4 // This file contains helper functions which provide information about the |
5 // current version of Chrome. This includes channel information, version | 5 // current version of Chrome. This includes channel information, version |
6 // information etc. This functionality is provided by using functions in | 6 // information etc. This functionality is provided by using functions in |
7 // kernel32 and advapi32. No other dependencies are allowed in this file. | 7 // kernel32 and advapi32. No other dependencies are allowed in this file. |
8 | 8 |
9 #ifndef CHROME_INSTALL_STATIC_INSTALL_UTIL_H_ | 9 #ifndef CHROME_INSTALL_STATIC_INSTALL_UTIL_H_ |
10 #define CHROME_INSTALL_STATIC_INSTALL_UTIL_H_ | 10 #define CHROME_INSTALL_STATIC_INSTALL_UTIL_H_ |
11 | 11 |
12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
13 | 13 |
14 namespace install_static { | |
14 enum class ProcessType { | 15 enum class ProcessType { |
15 UNINITIALIZED, | 16 UNINITIALIZED, |
16 NON_BROWSER_PROCESS, | 17 NON_BROWSER_PROCESS, |
17 BROWSER_PROCESS, | 18 BROWSER_PROCESS, |
18 }; | 19 }; |
19 | 20 |
21 // Chrome channel display names. | |
22 extern const wchar_t kChromeChannelUnknown[]; | |
23 extern const wchar_t kChromeChannelCanary[]; | |
24 extern const wchar_t kChromeChannelDev[]; | |
25 extern const wchar_t kChromeChannelBeta[]; | |
26 extern const wchar_t kChromeChannelStable[]; | |
27 extern const wchar_t kChromeChannelStableExplicit[]; | |
28 | |
20 // Returns true if |exe_path| points to a Chrome installed in an SxS | 29 // Returns true if |exe_path| points to a Chrome installed in an SxS |
21 // installation. | 30 // installation. |
22 bool IsCanary(const wchar_t* exe_path); | 31 bool IsCanary(const wchar_t* exe_path); |
23 | 32 |
24 // Returns true if |exe_path| points to a per-user level Chrome installation. | 33 // Returns true if |exe_path| points to a per-user level Chrome installation. |
25 bool IsSystemInstall(const wchar_t* exe_path); | 34 bool IsSystemInstall(const wchar_t* exe_path); |
26 | 35 |
27 // Returns true if current installation of Chrome is a multi-install. | 36 // Returns true if current installation of Chrome is a multi-install. |
28 bool IsMultiInstall(bool is_system_install); | 37 bool IsMultiInstall(bool is_system_install); |
29 | 38 |
30 // Returns true if usage stats collecting is enabled for this user. | 39 // Returns true if usage stats collecting is enabled for this user for the |
31 bool AreUsageStatsEnabled(const wchar_t* exe_path); | 40 // current executable. |
41 bool GetCollectStatsConsent(); | |
32 | 42 |
33 // Returns true if a policy is in effect. |breakpad_enabled| will be set to true | 43 // Returns true if usage stats collecting is enabled for this user for the |
34 // if stats collecting is permitted by this policy and false if not. | 44 // executable passed in as |exe_path|. |
45 bool GetCollectStatsConsentForExe(const base::string16& exe_path); | |
scottmg
2016/04/27 23:29:25
This is only available for tests, right? I'm worri
ananta
2016/04/28 00:04:25
Done.
| |
46 | |
47 // Returns true if a policy is in effect. |breakpad_enabled| will be set to | |
48 // true if stats collecting is permitted by this policy and false if not. | |
35 bool ReportingIsEnforcedByPolicy(bool* breakpad_enabled); | 49 bool ReportingIsEnforcedByPolicy(bool* breakpad_enabled); |
36 | 50 |
37 // Initializes |g_process_type| which stores whether or not the current process | 51 // Initializes |g_process_type| which stores whether or not the current |
38 // is the main browser process. | 52 // process is the main browser process. |
39 void InitializeProcessType(); | 53 void InitializeProcessType(); |
40 | 54 |
41 // Returns true if invoked in a Chrome process other than the main browser | 55 // Returns true if invoked in a Chrome process other than the main browser |
42 // process. False otherwise. | 56 // process. False otherwise. |
43 bool IsNonBrowserProcess(); | 57 bool IsNonBrowserProcess(); |
44 | 58 |
59 // Get the path to the user's data directory, regardless of whether | |
60 // DIR_USER_DATA has been overridden by a command-line option. | |
61 // TODO(ananta) | |
62 // http://crbug.com/604923 | |
63 // Unify this with the Browser Distribution code. | |
64 bool GetDefaultUserDataDirectory(base::string16* result); | |
65 | |
66 // Populates |crash_dir| with the default crash dump location regardless of | |
67 // whether DIR_USER_DATA or DIR_CRASH_DUMPS has been overridden. | |
68 // TODO(ananta) | |
69 // http://crbug.com/604923 | |
70 // Unify this with the Browser Distribution code. | |
71 bool GetDefaultCrashDumpLocation(base::string16* crash_dir); | |
72 | |
73 // Returns the contents of the specified |variable_name| from the environment | |
74 // block of the calling process. Returns an empty string if the variable does | |
75 // not exist. | |
76 std::string GetEnvironmentString(const std::string& variable_name); | |
77 | |
78 // Sets the environment variable identified by |variable_name| to the value | |
79 // identified by |new_value|. | |
80 bool SetEnvironmentString(const std::string& variable_name, | |
81 const std::string& new_value); | |
82 | |
83 // Returns true if the environment variable identified by |variable_name| | |
84 // exists. | |
85 bool HasEnvironmentVariable(const std::string& variable_name); | |
86 | |
87 // Gets the exe version details like the |product_name|, |version|, | |
88 // |special_build|, |channel_name|, etc. Most of this information is read | |
89 // from the version resource. |exe_path| is the path of chrome.exe. | |
90 // TODO(ananta) | |
91 // http://crbug.com/604923 | |
92 // Unify this with the Browser Distribution code. | |
93 bool GetExecutableVersionDetails(const base::string16& exe_path, | |
94 base::string16* product_name, | |
95 base::string16* version, | |
96 base::string16* special_build, | |
97 base::string16* channel_name); | |
98 | |
99 // Gets the channel name for the current Chrome process. | |
100 // TODO(ananta) | |
101 // http://crbug.com/604923 | |
102 // Unify this with the Browser Distribution code. | |
103 void GetChromeChannelName(bool is_per_user_install, | |
104 base::string16* channel_name); | |
105 | |
106 | |
107 // Returns the version of Google Update that is installed. | |
108 // TODO(ananta) | |
109 // http://crbug.com/604923 | |
110 // Unify this with the Browser Distribution code. | |
111 std::string GetGoogleUpdateVersion(); | |
112 | |
113 // Returns the Chrome installation subdirectory, i.e. Google Chrome\Chromium, | |
114 // etc. | |
115 // TODO(ananta) | |
116 // http://crbug.com/604923 | |
117 // Unify this with the Browser Distribution code. | |
118 base::string16 GetChromeInstallSubDirectory(); | |
119 | |
120 // Returns the registry path where the browser crash dumps metrics need to be | |
121 // written to. | |
122 // TODO(ananta) | |
123 // http://crbug.com/604923 | |
124 // Unify this with the version in | |
125 // chrome\common\metrics_constants_util_win.cc | |
126 base::string16 GetBrowserCrashDumpAttemptsRegistryPath(); | |
127 | |
45 // Caches the |ProcessType| of the current process. | 128 // Caches the |ProcessType| of the current process. |
46 extern ProcessType g_process_type; | 129 extern ProcessType g_process_type; |
47 | 130 |
131 } // namespace install_static | |
132 | |
48 #endif // CHROME_INSTALL_STATIC_INSTALL_UTIL_H_ | 133 #endif // CHROME_INSTALL_STATIC_INSTALL_UTIL_H_ |
OLD | NEW |