Index: chrome/browser/chromeos/gdata/gdata_cache.cc |
diff --git a/chrome/browser/chromeos/gdata/gdata_cache.cc b/chrome/browser/chromeos/gdata/gdata_cache.cc |
index 4c9ae4c313f1aa5b2f953025cb73826b2ef78338..0188d34ccb658febcb9ef8104c1b68c58f3c85d2 100644 |
--- a/chrome/browser/chromeos/gdata/gdata_cache.cc |
+++ b/chrome/browser/chromeos/gdata/gdata_cache.cc |
@@ -9,6 +9,7 @@ |
#include "base/chromeos/chromeos_version.h" |
#include "base/file_util.h" |
#include "base/logging.h" |
+#include "base/path_service.h" |
#include "base/stringprintf.h" |
#include "base/string_util.h" |
#include "base/sys_info.h" |
@@ -38,20 +39,6 @@ const FilePath::CharType kGDataCacheTmpDownloadsDir[] = |
const FilePath::CharType kGDataCacheTmpDocumentsDir[] = |
FILE_PATH_LITERAL("tmp/documents"); |
-// Returns the home directory path, or an empty string if the home directory |
-// is not found. |
-// Copied from webkit/chromeos/cros_mount_point_provider.h. |
-// TODO(satorux): Share the code. |
-std::string GetHomeDirectory() { |
- if (base::chromeos::IsRunningOnChromeOS()) |
- return "/home/chronos/user"; |
- |
- const char* home = getenv("HOME"); |
- if (home) |
- return home; |
- return ""; |
-} |
- |
// Used to tweak GetAmountOfFreeDiskSpace() behavior for testing. |
FreeDiskSpaceGetterInterface* global_free_disk_getter_for_testing = NULL; |
@@ -61,8 +48,11 @@ int64 GetAmountOfFreeDiskSpace() { |
if (global_free_disk_getter_for_testing) |
return global_free_disk_getter_for_testing->AmountOfFreeDiskSpace(); |
- return base::SysInfo::AmountOfFreeDiskSpace( |
- FilePath::FromUTF8Unsafe(GetHomeDirectory())); |
+ FilePath path; |
+ if (!PathService::Get(base::DIR_HOME, &path)) { |
satorux1
2012/08/03 16:46:01
This should not happen, but let's add:
LOG(ERROR)
Haruki Sato
2012/08/06 02:37:49
Done.
Thanks.
|
+ return -1; |
+ } |
kochi
2012/08/03 14:35:59
You don't need braces for this if (do as line 48)
Haruki Sato
2012/08/06 02:37:49
As I added another line in the clause, I'm keeping
|
+ return base::SysInfo::AmountOfFreeDiskSpace(path); |
} |
// Returns true if we have sufficient space to store the given number of |