Add support for GetHomeDir for Mac and Windows.

Unifies the Path Service's base::DIR_HOME on Posix and base::DIR_PROFILE on Windows to just be base::DIR_HOME everywhere, and DIR_HOME will now work on Mac.

This removes the AssertIOAllowed check in the Posix implementation because that was only executed in a fallback case that no developer is likely to ever hit. In addition, the we do call this type of function on the UI thread, so either we need to promote the assertion to be at the top of the function or delete it. It seemed unreasonable to disallow using this one key of the path service on the UI thread (the other ones are OK) so I just went for deleting the assertion.

R=benwells@chromium.org

Review URL: https://codereview.chromium.org/159833003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@252066 0039d316-1c4b-4281-b951-d872f2087c98


CrOS-Libchrome-Original-Commit: ffaee18e8a876257e5a9fed3eca6afcd60f481e1
diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc
index ec1a22c..f17b341 100644
--- a/base/file_util_posix.cc
+++ b/base/file_util_posix.cc
@@ -481,7 +481,7 @@
 }
 #endif  // !defined(OS_MACOSX) && !defined(OS_ANDROID)
 
-#if !defined(OS_MACOSX)
+#if !defined(OS_MACOSX)  // Mac implementation is in file_util_mac.mm.
 FilePath GetHomeDir() {
 #if defined(OS_CHROMEOS)
   if (SysInfo::IsRunningOnChromeOS())
@@ -495,9 +495,12 @@
 #if defined(OS_ANDROID)
   DLOG(WARNING) << "OS_ANDROID: Home directory lookup not yet implemented.";
 #elif defined(USE_GLIB) && !defined(OS_CHROMEOS)
-  // g_get_home_dir calls getpwent, which can fall through to LDAP calls.
-  ThreadRestrictions::AssertIOAllowed();
-
+  // g_get_home_dir calls getpwent, which can fall through to LDAP calls so
+  // this may do I/O. However, it should be rare that $HOME is not defined and
+  // this is typically called from the path service which has no threading
+  // restrictions. The path service will cache the result which limits the
+  // badness of blocking on I/O. As a result, we don't have a thread
+  // restriction here.
   home_dir = g_get_home_dir();
   if (home_dir && home_dir[0])
     return FilePath(home_dir);