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

Side by Side Diff: chrome/install_static/install_util.h

Issue 1913943003: Remove dependencies on chrome\installer from the ChromeCrashReporterClient class on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix build error Created 4 years, 7 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
OLDNEW
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 {
15
14 enum class ProcessType { 16 enum class ProcessType {
15 UNINITIALIZED, 17 UNINITIALIZED,
16 NON_BROWSER_PROCESS, 18 NON_BROWSER_PROCESS,
17 BROWSER_PROCESS, 19 BROWSER_PROCESS,
18 }; 20 };
19 21
22 // TODO(ananta)
23 // http://crbug.com/604923
24 // The constants defined in this file are also defined in chrome/installer and
25 // other places. we need to unify them.
26
27 extern const wchar_t kChromeChannelUnknown[];
28 extern const wchar_t kChromeChannelCanary[];
29 extern const wchar_t kChromeChannelDev[];
30 extern const wchar_t kChromeChannelBeta[];
31 extern const wchar_t kChromeChannelStable[];
32 extern const wchar_t kChromeChannelStableExplicit[];
33 extern const wchar_t kRegPathClientState[];
34 extern const wchar_t kRegPathClientStateMedium[];
35 extern const wchar_t kRegPathChromePolicy[];
36 extern const wchar_t kRegApField[];
37 extern const wchar_t kRegValueUsageStats[];
38 extern const wchar_t kUninstallArgumentsField[];
39 extern const wchar_t kMetricsReportingEnabled[];
40 extern const wchar_t kAppGuidCanary[];
41 extern const wchar_t kAppGuidGoogleChrome[];
42 extern const wchar_t kAppGuidGoogleBinaries[];
43
20 // Returns true if |exe_path| points to a Chrome installed in an SxS 44 // Returns true if |exe_path| points to a Chrome installed in an SxS
21 // installation. 45 // installation.
22 bool IsCanary(const wchar_t* exe_path); 46 bool IsSxSChrome(const wchar_t* exe_path);
23 47
24 // Returns true if |exe_path| points to a per-user level Chrome installation. 48 // Returns true if |exe_path| points to a per-user level Chrome installation.
25 bool IsSystemInstall(const wchar_t* exe_path); 49 bool IsSystemInstall(const wchar_t* exe_path);
26 50
27 // Returns true if current installation of Chrome is a multi-install. 51 // Returns true if current installation of Chrome is a multi-install.
28 bool IsMultiInstall(bool is_system_install); 52 bool IsMultiInstall(bool is_system_install);
29 53
30 // Returns true if usage stats collecting is enabled for this user. 54 // Returns true if usage stats collecting is enabled for this user for the
31 bool AreUsageStatsEnabled(const wchar_t* exe_path); 55 // current executable.
56 bool GetCollectStatsConsent();
32 57
33 // Returns true if a policy is in effect. |breakpad_enabled| will be set to true 58 // 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. 59 // executable passed in as |exe_path|.
35 bool ReportingIsEnforcedByPolicy(bool* breakpad_enabled); 60 // Only used by tests.
61 bool GetCollectStatsConsentForTesting(const base::string16& exe_path);
36 62
37 // Initializes |g_process_type| which stores whether or not the current process 63 // Returns true if if usage stats reporting is controlled by a mandatory
38 // is the main browser process. 64 // policy. |metrics_is_enforced_by_policy| will be set to true accordingly.
65 // TODO(ananta)
66 // Make this function private to install_util.
67 bool ReportingIsEnforcedByPolicy(bool* metrics_is_enforced_by_policy);
68
69 // Initializes |g_process_type| which stores whether or not the current
70 // process is the main browser process.
39 void InitializeProcessType(); 71 void InitializeProcessType();
40 72
41 // Returns true if invoked in a Chrome process other than the main browser 73 // Returns true if invoked in a Chrome process other than the main browser
42 // process. False otherwise. 74 // process. False otherwise.
43 bool IsNonBrowserProcess(); 75 bool IsNonBrowserProcess();
44 76
77 // Populates |result| with the default User Data directory for the current
78 // user.This may be overidden by a command line option.Returns false if all
79 // attempts at locating a User Data directory fail
80 // TODO(ananta)
81 // http://crbug.com/604923
82 // Unify this with the Browser Distribution code.
83 bool GetDefaultUserDataDirectory(base::string16* result);
84
85 // Populates |crash_dir| with the default crash dump location regardless of
86 // whether DIR_USER_DATA or DIR_CRASH_DUMPS has been overridden.
87 // TODO(ananta)
88 // http://crbug.com/604923
89 // Unify this with the Browser Distribution code.
90 bool GetDefaultCrashDumpLocation(base::string16* crash_dir);
91
92 // Returns the contents of the specified |variable_name| from the environment
93 // block of the calling process. Returns an empty string if the variable does
94 // not exist.
95 std::string GetEnvironmentString(const std::string& variable_name);
96
97 // Sets the environment variable identified by |variable_name| to the value
98 // identified by |new_value|.
99 bool SetEnvironmentString(const std::string& variable_name,
100 const std::string& new_value);
101
102 // Returns true if the environment variable identified by |variable_name|
103 // exists.
104 bool HasEnvironmentVariable(const std::string& variable_name);
105
106 // Gets the exe version details like the |product_name|, |version|,
107 // |special_build|, |channel_name|, etc. Most of this information is read
108 // from the version resource. |exe_path| is the path of chrome.exe.
109 // TODO(ananta)
110 // http://crbug.com/604923
111 // Unify this with the Browser Distribution code.
112 bool GetExecutableVersionDetails(const base::string16& exe_path,
113 base::string16* product_name,
114 base::string16* version,
115 base::string16* special_build,
116 base::string16* channel_name);
117
118 // Gets the channel name for the current Chrome process.
119 // TODO(ananta)
120 // http://crbug.com/604923
121 // Unify this with the Browser Distribution code.
122 void GetChromeChannelName(bool is_per_user_install,
grt (UTC plus 2) 2016/05/03 15:54:55 please mention in the document that this does not
ananta 2016/05/03 21:40:57 Updated the comment to indicate that we only retur
123 base::string16* channel_name);
124
125
126 // Returns the version of Google Update that is installed.
127 // TODO(ananta)
128 // http://crbug.com/604923
129 // Unify this with the Browser Distribution code.
130 std::string GetGoogleUpdateVersion();
131
132 // Returns the Chrome installation subdirectory, i.e. Google Chrome\Chromium,
133 // etc.
134 // TODO(ananta)
135 // http://crbug.com/604923
136 // Unify this with the Browser Distribution code.
137 base::string16 GetChromeInstallSubDirectory();
138
139 // Returns the registry path where the browser crash dumps metrics need to be
140 // written to.
141 // TODO(ananta)
142 // http://crbug.com/604923
143 // Unify this with the version in
144 // chrome\common\metrics_constants_util_win.cc
145 base::string16 GetBrowserCrashDumpAttemptsRegistryPath();
146
147 // Returns true if the |source| string matches the |pattern|. The pattern
148 // may contain wildcards like '?', which matches one character or a '*'
149 // which matches 0 or more characters.
150 // Please note that pattern matches the whole string. If you want to find
151 // something in the middle of the string then you need to specify the pattern
152 // as '*xyz*'.
153 bool MatchPattern(const base::string16& source, const base::string16& pattern);
154
45 // Caches the |ProcessType| of the current process. 155 // Caches the |ProcessType| of the current process.
46 extern ProcessType g_process_type; 156 extern ProcessType g_process_type;
47 157
158 } // namespace install_static
159
48 #endif // CHROME_INSTALL_STATIC_INSTALL_UTIL_H_ 160 #endif // CHROME_INSTALL_STATIC_INSTALL_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698