Move all callers of GetHomeDir() to PathService::Get(base::DIR_HOME).
* Fixes GetHomeDir() for multi-profiles case on Chrome OS.
* Once user signs in on Chrome OS base::DIR_HOME is overridden with primary user homedir.
* Added content switch --homedir to pass that information to ppapi plugins since they
run in a separate process and previous base::DIR_HOME override does not apply there.
This fix doesn't require checking for --multi-profiles switch
since user_id hash is known even without it.
Note:
download_prefs.cc still uses GetHomeDir() in its DownloadPathIsDangerous() check.
// Consider downloads 'dangerous' if they go to the home directory on Linux and
// to the desktop on any platform.
In this context correct behavior is to use "real" base::GetHomeDir() and not "virtual one" base::DIR_HOME.
Since latter is remapped to some test dir in tests, in some subfolders in Chrome OS etc.
BUG=331530
[email protected]
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=270872
Review URL: https://codereview.chromium.org/200473002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@272898 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/crypto/nss_util.cc b/crypto/nss_util.cc
index da46b63..5958ad97 100644
--- a/crypto/nss_util.cc
+++ b/crypto/nss_util.cc
@@ -21,6 +21,7 @@
#include <map>
#include <vector>
+#include "base/base_paths.h"
#include "base/bind.h"
#include "base/cpu.h"
#include "base/debug/alias.h"
@@ -34,6 +35,7 @@
#include "base/message_loop/message_loop.h"
#include "base/metrics/histogram.h"
#include "base/native_library.h"
+#include "base/path_service.h"
#include "base/stl_util.h"
#include "base/strings/stringprintf.h"
#include "base/threading/thread_checker.h"
@@ -80,7 +82,8 @@
#if defined(USE_NSS)
base::FilePath GetDefaultConfigDirectory() {
- base::FilePath dir = base::GetHomeDir();
+ base::FilePath dir;
+ PathService::Get(base::DIR_HOME, &dir);
if (dir.empty()) {
LOG(ERROR) << "Failed to get home directory.";
return dir;