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

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: Update comment 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 {
grt (UTC plus 2) 2016/04/29 20:50:57 nit: blank line after this
ananta 2016/04/29 22:49:25 Done.
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);
grt (UTC plus 2) 2016/04/29 20:50:57 in general "SxS" is used to name the "the Chrome i
ananta 2016/04/29 22:49:24 Changed to IsSxSChrome
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 // Only used by tests.
46 bool GetCollectStatsConsentForTesting(const base::string16& exe_path);
47
48 // Returns true if a policy is in effect. |breakpad_enabled| will be set to
grt (UTC plus 2) 2016/04/29 20:50:57 "if a policy is in effect" -> "if usage stats repo
ananta 2016/04/29 22:49:24 Done.
49 // true if stats collecting is permitted by this policy and false if not.
35 bool ReportingIsEnforcedByPolicy(bool* breakpad_enabled); 50 bool ReportingIsEnforcedByPolicy(bool* breakpad_enabled);
36 51
37 // Initializes |g_process_type| which stores whether or not the current process 52 // Initializes |g_process_type| which stores whether or not the current
38 // is the main browser process. 53 // process is the main browser process.
39 void InitializeProcessType(); 54 void InitializeProcessType();
40 55
41 // Returns true if invoked in a Chrome process other than the main browser 56 // Returns true if invoked in a Chrome process other than the main browser
42 // process. False otherwise. 57 // process. False otherwise.
43 bool IsNonBrowserProcess(); 58 bool IsNonBrowserProcess();
44 59
60 // Get the path to the user's data directory, regardless of whether
grt (UTC plus 2) 2016/04/29 20:50:57 nit: "Populates |result| with the default User Dat
ananta 2016/04/29 22:49:24 Done.
61 // DIR_USER_DATA has been overridden by a command-line option.
62 // TODO(ananta)
63 // http://crbug.com/604923
64 // Unify this with the Browser Distribution code.
65 bool GetDefaultUserDataDirectory(base::string16* result);
66
67 // Populates |crash_dir| with the default crash dump location regardless of
68 // whether DIR_USER_DATA or DIR_CRASH_DUMPS has been overridden.
69 // TODO(ananta)
70 // http://crbug.com/604923
71 // Unify this with the Browser Distribution code.
72 bool GetDefaultCrashDumpLocation(base::string16* crash_dir);
73
74 // Returns the contents of the specified |variable_name| from the environment
75 // block of the calling process. Returns an empty string if the variable does
76 // not exist.
77 std::string GetEnvironmentString(const std::string& variable_name);
78
79 // Sets the environment variable identified by |variable_name| to the value
80 // identified by |new_value|.
81 bool SetEnvironmentString(const std::string& variable_name,
82 const std::string& new_value);
83
84 // Returns true if the environment variable identified by |variable_name|
85 // exists.
86 bool HasEnvironmentVariable(const std::string& variable_name);
87
88 // Gets the exe version details like the |product_name|, |version|,
89 // |special_build|, |channel_name|, etc. Most of this information is read
90 // from the version resource. |exe_path| is the path of chrome.exe.
91 // TODO(ananta)
92 // http://crbug.com/604923
93 // Unify this with the Browser Distribution code.
94 bool GetExecutableVersionDetails(const base::string16& exe_path,
95 base::string16* product_name,
96 base::string16* version,
97 base::string16* special_build,
98 base::string16* channel_name);
99
100 // Gets the channel name for the current Chrome process.
101 // TODO(ananta)
102 // http://crbug.com/604923
103 // Unify this with the Browser Distribution code.
104 void GetChromeChannelName(bool is_per_user_install,
105 base::string16* channel_name);
106
107
108 // Returns the version of Google Update that is installed.
109 // TODO(ananta)
110 // http://crbug.com/604923
111 // Unify this with the Browser Distribution code.
112 std::string GetGoogleUpdateVersion();
113
114 // Returns the Chrome installation subdirectory, i.e. Google Chrome\Chromium,
115 // etc.
116 // TODO(ananta)
117 // http://crbug.com/604923
118 // Unify this with the Browser Distribution code.
119 base::string16 GetChromeInstallSubDirectory();
120
121 // Returns the registry path where the browser crash dumps metrics need to be
122 // written to.
123 // TODO(ananta)
124 // http://crbug.com/604923
125 // Unify this with the version in
126 // chrome\common\metrics_constants_util_win.cc
127 base::string16 GetBrowserCrashDumpAttemptsRegistryPath();
128
129 // Returns true if the |source| string matches the |pattern|. The pattern
130 // may contain wildcards like '?', which matches one character or a '*'
131 // which matches 0 or more characters.
132 // Please note that pattern matches the whole string. If you want to find
133 // something in the middle of the string then you need to specify the pattern
134 // as '*xyz*'.
135 bool MatchPattern(const base::string16& source, const base::string16& pattern);
136
45 // Caches the |ProcessType| of the current process. 137 // Caches the |ProcessType| of the current process.
46 extern ProcessType g_process_type; 138 extern ProcessType g_process_type;
47 139
140 } // namespace install_static
141
48 #endif // CHROME_INSTALL_STATIC_INSTALL_UTIL_H_ 142 #endif // CHROME_INSTALL_STATIC_INSTALL_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698