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

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: . 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 // 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_
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 // https://crbug.com/604923 53 // https://crbug.com/604923
54 // Unify these constants with env_vars.h. 54 // Unify these constants with env_vars.h.
55 extern const wchar_t kHeadless[]; 55 extern const wchar_t kHeadless[];
56 extern const wchar_t kShowRestart[]; 56 extern const wchar_t kShowRestart[];
57 extern const wchar_t kRestartInfo[]; 57 extern const wchar_t kRestartInfo[];
58 extern const wchar_t kRtlLocale[]; 58 extern const wchar_t kRtlLocale[];
59 59
60 // TODO(ananta) 60 // TODO(ananta)
61 // https://crbug.com/604923 61 // https://crbug.com/604923
62 // Unify these constants with those defined in content_switches.h. 62 // Unify these constants with those defined in content_switches.h.
63 extern const char kGpuProcess[]; 63 extern const wchar_t kCrashpadHandler[];
64 extern const char kPpapiPluginProcess[]; 64 extern const wchar_t kProcessType[];
65 extern const char kRendererProcess[]; 65 extern const wchar_t kUserDataDirSwitch[];
66 extern const char kUtilityProcess[]; 66 extern const wchar_t kUtilityProcess[];
67 extern const char kProcessType[];
68 extern const char kCrashpadHandler[];
69 67
70 // Returns true if |exe_path| points to a Chrome installed in an SxS 68 // Returns true if |exe_path| points to a Chrome installed in an SxS
71 // installation. 69 // installation.
72 bool IsSxSChrome(const wchar_t* exe_path); 70 bool IsSxSChrome(const wchar_t* exe_path);
73 71
74 // Returns true if |exe_path| points to a per-user level Chrome installation. 72 // Returns true if |exe_path| points to a per-user level Chrome installation.
75 bool IsSystemInstall(const wchar_t* exe_path); 73 bool IsSystemInstall(const wchar_t* exe_path);
76 74
77 // Returns true if current installation of Chrome is a multi-install. 75 // Returns true if current installation of Chrome is a multi-install.
78 bool IsMultiInstall(bool is_system_install); 76 bool IsMultiInstall(bool is_system_install);
(...skipping 22 matching lines...) Expand all
101 99
102 // Initializes |g_process_type| which stores whether or not the current 100 // Initializes |g_process_type| which stores whether or not the current
103 // process is the main browser process. 101 // process is the main browser process.
104 void InitializeProcessType(); 102 void InitializeProcessType();
105 103
106 // Returns true if invoked in a Chrome process other than the main browser 104 // Returns true if invoked in a Chrome process other than the main browser
107 // process. False otherwise. 105 // process. False otherwise.
108 bool IsNonBrowserProcess(); 106 bool IsNonBrowserProcess();
109 107
110 // Populates |result| with the default User Data directory for the current 108 // Populates |result| with the default User Data directory for the current
111 // user.This may be overidden by a command line option.Returns false if all 109 // user. Returns false if all attempts at locating a User Data directory fail.
112 // attempts at locating a User Data directory fail
113 // TODO(ananta) 110 // TODO(ananta)
114 // http://crbug.com/604923 111 // http://crbug.com/604923
115 // Unify this with the Browser Distribution code. 112 // Unify this with the Browser Distribution code.
116 bool GetDefaultUserDataDirectory(std::wstring* result); 113 bool GetDefaultUserDataDirectory(std::wstring* result);
117 114
118 // Populates |crash_dir| with the default crash dump location regardless of 115 // Populates |result| with the user data dir, respecting various overrides in
119 // whether DIR_USER_DATA or DIR_CRASH_DUMPS has been overridden. 116 // the manner of chrome_main_delegate.cc InitializeUserDataDir(). This includes
117 // overrides on the command line, overrides by registry policy, and fallback to
118 // the default User Data dir if the directory is invalid or unspecified.
119 bool GetUserDataDirectory(std::wstring* result);
120
121 // Populates |crash_dir| with the crash dump location, respecting modifications
122 // to user-data-dir.
120 // TODO(ananta) 123 // TODO(ananta)
121 // http://crbug.com/604923 124 // http://crbug.com/604923
122 // Unify this with the Browser Distribution code. 125 // Unify this with the Browser Distribution code.
123 bool GetDefaultCrashDumpLocation(std::wstring* crash_dir); 126 bool GetCrashDumpLocation(std::wstring* crash_dir);
124 127
125 // Returns the contents of the specified |variable_name| from the environment 128 // Returns the contents of the specified |variable_name| from the environment
126 // block of the calling process. Returns an empty string if the variable does 129 // block of the calling process. Returns an empty string if the variable does
127 // not exist. 130 // not exist.
128 std::string GetEnvironmentString(const std::string& variable_name); 131 std::string GetEnvironmentString(const std::string& variable_name);
129 std::wstring GetEnvironmentString16(const std::wstring& variable_name); 132 std::wstring GetEnvironmentString16(const std::wstring& variable_name);
130 133
131 // Sets the environment variable identified by |variable_name| to the value 134 // Sets the environment variable identified by |variable_name| to the value
132 // identified by |new_value|. 135 // identified by |new_value|.
133 bool SetEnvironmentString(const std::string& variable_name, 136 bool SetEnvironmentString(const std::string& variable_name,
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 // -1 if version1 < version2. 216 // -1 if version1 < version2.
214 // 1 if version1 > version2. 217 // 1 if version1 > version2.
215 // Returns true on success, false on invalid strings being passed, etc. 218 // Returns true on success, false on invalid strings being passed, etc.
216 bool CompareVersionStrings(const std::string& version1, 219 bool CompareVersionStrings(const std::string& version1,
217 const std::string& version2, 220 const std::string& version2,
218 int* result); 221 int* result);
219 222
220 // We assume that the command line |command_line| contains multiple switches 223 // We assume that the command line |command_line| contains multiple switches
221 // with the format --<switch name>=<switch value>. This function returns the 224 // with the format --<switch name>=<switch value>. This function returns the
222 // value of the |switch_name| passed in. 225 // value of the |switch_name| passed in.
223 std::string GetSwitchValueFromCommandLine(const std::string& command_line, 226 std::wstring GetSwitchValueFromCommandLine(const std::wstring& command_line,
224 const std::string& switch_name); 227 const std::wstring& switch_name);
225 228
226 // Caches the |ProcessType| of the current process. 229 // Caches the |ProcessType| of the current process.
227 extern ProcessType g_process_type; 230 extern ProcessType g_process_type;
228 231
229 } // namespace install_static 232 } // namespace install_static
230 233
231 #endif // CHROME_INSTALL_STATIC_INSTALL_UTIL_H_ 234 #endif // CHROME_INSTALL_STATIC_INSTALL_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698