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

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

Issue 2549593002: Revert of Make Crashpad use the user data dir, rather than always default location (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « chrome/install_static/install_details.h ('k') | chrome/install_static/install_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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_
(...skipping 24 matching lines...) Expand all
35 // https://crbug.com/604923 35 // https://crbug.com/604923
36 // Unify these constants with env_vars.h. 36 // Unify these constants with env_vars.h.
37 extern const wchar_t kHeadless[]; 37 extern const wchar_t kHeadless[];
38 extern const wchar_t kShowRestart[]; 38 extern const wchar_t kShowRestart[];
39 extern const wchar_t kRestartInfo[]; 39 extern const wchar_t kRestartInfo[];
40 extern const wchar_t kRtlLocale[]; 40 extern const wchar_t kRtlLocale[];
41 41
42 // TODO(ananta) 42 // TODO(ananta)
43 // https://crbug.com/604923 43 // https://crbug.com/604923
44 // Unify these constants with those defined in content_switches.h. 44 // Unify these constants with those defined in content_switches.h.
45 extern const wchar_t kCrashpadHandler[]; 45 extern const char kGpuProcess[];
46 extern const wchar_t kProcessType[]; 46 extern const char kPpapiPluginProcess[];
47 extern const wchar_t kUserDataDirSwitch[]; 47 extern const char kRendererProcess[];
48 extern const wchar_t kUtilityProcess[]; 48 extern const char kUtilityProcess[];
49 49 extern const char kProcessType[];
50 // Used for suppressing warnings. 50 extern const char kCrashpadHandler[];
51 template <typename T> inline void IgnoreUnused(T) {}
52 51
53 // Returns true if Chrome is running at system level. 52 // Returns true if Chrome is running at system level.
54 bool IsSystemInstall(); 53 bool IsSystemInstall();
55 54
56 // Returns true if current installation of Chrome is a multi-install. 55 // Returns true if current installation of Chrome is a multi-install.
57 bool IsMultiInstall(); 56 bool IsMultiInstall();
58 57
59 // Returns true if usage stats collecting is enabled for this user for the 58 // Returns true if usage stats collecting is enabled for this user for the
60 // current executable. 59 // current executable.
61 bool GetCollectStatsConsent(); 60 bool GetCollectStatsConsent();
62 61
63 // Returns true if the current executable is currently in the chosen sample that 62 // Returns true if the current executable is currently in the chosen sample that
64 // will report stats and crashes. 63 // will report stats and crashes.
65 bool GetCollectStatsInSample(); 64 bool GetCollectStatsInSample();
66 65
67 // Sets the registry value used for checking if Chrome is in the chosen sample 66 // Sets the registry value used for checking if Chrome is in the chosen sample
68 // that will report stats and crashes. Returns true if writing was successful. 67 // that will report stats and crashes. Returns true if writing was successful.
69 bool SetCollectStatsInSample(bool in_sample); 68 bool SetCollectStatsInSample(bool in_sample);
70 69
71 // Appends "[kCompanyPathName\]kProductPathName[install_suffix]" to |path|,
72 // returning a reference to |path|.
73 std::wstring& AppendChromeInstallSubDirectory(const InstallConstants& mode,
74 bool include_suffix,
75 std::wstring* path);
76
77 // Returns true if if usage stats reporting is controlled by a mandatory 70 // Returns true if if usage stats reporting is controlled by a mandatory
78 // policy. |crash_reporting_enabled| determines whether it's enabled (true) or 71 // policy. |crash_reporting_enabled| determines whether it's enabled (true) or
79 // disabled (false). 72 // disabled (false).
80 bool ReportingIsEnforcedByPolicy(bool* crash_reporting_enabled); 73 bool ReportingIsEnforcedByPolicy(bool* crash_reporting_enabled);
81 74
82 // Initializes |g_process_type| which stores whether or not the current 75 // Initializes |g_process_type| which stores whether or not the current
83 // process is the main browser process. 76 // process is the main browser process.
84 void InitializeProcessType(); 77 void InitializeProcessType();
85 78
86 // Returns true if invoked in a Chrome process other than the main browser 79 // Returns true if invoked in a Chrome process other than the main browser
87 // process. False otherwise. 80 // process. False otherwise.
88 bool IsNonBrowserProcess(); 81 bool IsNonBrowserProcess();
89 82
90 // Populates |crash_dir| with the crash dump location, respecting modifications 83 // Populates |result| with the default User Data directory for the current
91 // to user-data-dir. 84 // user.This may be overidden by a command line option.Returns false if all
85 // attempts at locating a User Data directory fail
92 // TODO(ananta) 86 // TODO(ananta)
93 // http://crbug.com/604923 87 // http://crbug.com/604923
94 // Unify this with the Browser Distribution code. 88 // Unify this with the Browser Distribution code.
95 std::wstring GetCrashDumpLocation(); 89 bool GetDefaultUserDataDirectory(std::wstring* result);
90
91 // Populates |crash_dir| with the default crash dump location regardless of
92 // whether DIR_USER_DATA or DIR_CRASH_DUMPS has been overridden.
93 // TODO(ananta)
94 // http://crbug.com/604923
95 // Unify this with the Browser Distribution code.
96 bool GetDefaultCrashDumpLocation(std::wstring* crash_dir);
96 97
97 // Returns the contents of the specified |variable_name| from the environment 98 // Returns the contents of the specified |variable_name| from the environment
98 // block of the calling process. Returns an empty string if the variable does 99 // block of the calling process. Returns an empty string if the variable does
99 // not exist. 100 // not exist.
100 std::string GetEnvironmentString(const std::string& variable_name); 101 std::string GetEnvironmentString(const std::string& variable_name);
101 std::wstring GetEnvironmentString16(const wchar_t* variable_name); 102 std::wstring GetEnvironmentString16(const wchar_t* variable_name);
102 103
103 // Sets the environment variable identified by |variable_name| to the value 104 // Sets the environment variable identified by |variable_name| to the value
104 // identified by |new_value|. 105 // identified by |new_value|.
105 bool SetEnvironmentString(const std::string& variable_name, 106 bool SetEnvironmentString(const std::string& variable_name,
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 std::vector<std::string> TokenizeString(const std::string& str, 161 std::vector<std::string> TokenizeString(const std::string& str,
161 char delimiter, 162 char delimiter,
162 bool trim_spaces); 163 bool trim_spaces);
163 std::vector<std::wstring> TokenizeString16(const std::wstring& str, 164 std::vector<std::wstring> TokenizeString16(const std::wstring& str,
164 wchar_t delimiter, 165 wchar_t delimiter,
165 bool trim_spaces); 166 bool trim_spaces);
166 167
167 // We assume that the command line |command_line| contains multiple switches 168 // We assume that the command line |command_line| contains multiple switches
168 // with the format --<switch name>=<switch value>. This function returns the 169 // with the format --<switch name>=<switch value>. This function returns the
169 // value of the |switch_name| passed in. 170 // value of the |switch_name| passed in.
170 std::wstring GetSwitchValueFromCommandLine(const std::wstring& command_line, 171 std::string GetSwitchValueFromCommandLine(const std::string& command_line,
171 const std::wstring& switch_name); 172 const std::string& switch_name);
172
173 // Ensures that the given |full_path| exists, and that the tail component is a
174 // directory. If the directory does not already exist, it will be created.
175 // Returns false if the final component exists but is not a directory, or on
176 // failure to create a directory.
177 bool RecursiveDirectoryCreate(const std::wstring& full_path);
178 173
179 // Returns the unadorned channel name based on the channel strategy for the 174 // Returns the unadorned channel name based on the channel strategy for the
180 // install mode. 175 // install mode.
181 std::wstring DetermineChannel(const InstallConstants& mode, 176 std::wstring DetermineChannel(const InstallConstants& mode,
182 bool system_level, 177 bool system_level,
183 bool multi_install); 178 bool multi_install);
184 179
185 // Caches the |ProcessType| of the current process. 180 // Caches the |ProcessType| of the current process.
186 extern ProcessType g_process_type; 181 extern ProcessType g_process_type;
187 182
188 } // namespace install_static 183 } // namespace install_static
189 184
190 #endif // CHROME_INSTALL_STATIC_INSTALL_UTIL_H_ 185 #endif // CHROME_INSTALL_STATIC_INSTALL_UTIL_H_
OLDNEW
« no previous file with comments | « chrome/install_static/install_details.h ('k') | chrome/install_static/install_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698