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

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

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

Powered by Google App Engine
This is Rietveld 408576698