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

Unified Diff: chrome/install_static/user_data_dir.h

Issue 2487783002: Make Crashpad use the user data dir, rather than always default location (Closed)
Patch Set: install_static for swarming 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 side-by-side diff with in-line comments
Download patch
Index: chrome/install_static/user_data_dir.h
diff --git a/chrome/install_static/user_data_dir.h b/chrome/install_static/user_data_dir.h
new file mode 100644
index 0000000000000000000000000000000000000000..f7b35ec428ee187f02931b269401199164b9c8d8
--- /dev/null
+++ b/chrome/install_static/user_data_dir.h
@@ -0,0 +1,44 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_INSTALL_STATIC_USER_DATA_DIR_H_
+#define CHROME_INSTALL_STATIC_USER_DATA_DIR_H_
+
+#include <string>
+
+namespace install_static {
+
+struct InstallConstants;
+
+// Populates |result| with the user data dir, respecting various overrides in
+// the manner of chrome_main_delegate.cc InitializeUserDataDir(). This includes
+// overrides on the command line, overrides by registry policy, and fallback to
+// the default User Data dir if the directory is invalid or unspecified.
+//
+// If a directory was given by the user (either on the command line, or by
+// registry policy), but it was invalid or unusable, then
+// |invalid_supplied_directory| will be filled with the value that was unusable
+// for reporting an error to the user.
+//
+// Other than in test situations, it is generally only appropriate to call this
+// function once on startup and use the result for subsequent callers, otherwise
+// there's a race with registry modification (which could cause a different
+// derivation) so different subsystems would see different values). In normal
+// usage, it should be called only once and cached. GetUserDataDirectory() does
+// this, and should be preferred.
+bool GetUserDataDirectoryImpl(
+ const std::wstring& user_data_dir_from_command_line,
+ const InstallConstants& mode,
+ std::wstring* result,
+ std::wstring* invalid_supplied_directory);
+
+// Retrieves the user data directory, and any invalid directory specified on the
+// command line, for reporting an error to the user. These values are cached on
+// the first call. |invalid_user_data_directory| may be null if not required.
+bool GetUserDataDirectory(std::wstring* user_data_directory,
+ std::wstring* invalid_user_data_directory);
+
+} // namespace install_static
+
+#endif // CHROME_INSTALL_STATIC_USER_DATA_DIR_H_

Powered by Google App Engine
This is Rietveld 408576698