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

Unified Diff: chrome/browser/chromeos/gdata/gdata_cache.cc

Issue 10843041: Add OS_CHROMEOS case in file_util::GetHomeDir() (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix styles Created 8 years, 4 months 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
« no previous file with comments | « base/file_util_posix.cc ('k') | webkit/chromeos/fileapi/cros_mount_point_provider.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 6b2efb326d501475a755d3341c40fe6c673eae06..3af5532639fed9812cd2012789168f589f731d85 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,12 @@ 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)) {
+ LOG(ERROR) << "Home directory not found";
+ return -1;
+ }
+ return base::SysInfo::AmountOfFreeDiskSpace(path);
}
// Returns true if we have sufficient space to store the given number of
« no previous file with comments | « base/file_util_posix.cc ('k') | webkit/chromeos/fileapi/cros_mount_point_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698