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

Unified Diff: components/drive/file_cache.cc

Issue 1215503010: OBSOLETE: Move (most of) chrome/browser/chromeos/drive into components/drive. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@drive-componentize-service
Patch Set: Created 5 years, 6 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
Index: components/drive/file_cache.cc
diff --git a/chrome/browser/chromeos/drive/file_cache.cc b/components/drive/file_cache.cc
similarity index 98%
rename from chrome/browser/chromeos/drive/file_cache.cc
rename to components/drive/file_cache.cc
index b4bb2051f09a1e41d80c01bfefe9e6ef090f162e..4bae5f99fe294d62ad3843459e021d16cb20ace9 100644
--- a/chrome/browser/chromeos/drive/file_cache.cc
+++ b/components/drive/file_cache.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/chromeos/drive/file_cache.h"
+#include "components/drive/file_cache.h"
#include <vector>
@@ -17,16 +17,17 @@
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/sys_info.h"
-#include "chrome/browser/chromeos/drive/drive.pb.h"
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
-#include "chrome/browser/chromeos/drive/resource_metadata_storage.h"
-#include "chromeos/chromeos_constants.h"
+#include "components/drive/drive.pb.h"
#include "components/drive/drive_api_util.h"
+#include "components/drive/file_system_core_util.h"
+#include "components/drive/resource_metadata_storage.h"
#include "google_apis/drive/task_util.h"
#include "net/base/filename_util.h"
#include "net/base/mime_sniffer.h"
#include "net/base/mime_util.h"
+#if defined(OS_CHROMEOS)
#include "third_party/cros_system_api/constants/cryptohome.h"
+#endif
namespace drive {
namespace internal {
@@ -243,8 +244,9 @@ FileError FileCache::MarkAsMounted(const std::string& id,
if (mounted_files_.count(id))
return FILE_ERROR_INVALID_OPERATION;
- // Ensure the file is readable to cros_disks. See crbug.com/236994.
base::FilePath path = GetCacheFilePath(id);
+#if defined(OS_POSIX)
+ // Ensure the file is readable to cros_disks. See crbug.com/236994.
if (!base::SetPosixFilePermissions(
path,
base::FILE_PERMISSION_READ_BY_USER |
@@ -252,6 +254,7 @@ FileError FileCache::MarkAsMounted(const std::string& id,
base::FILE_PERMISSION_READ_BY_GROUP |
base::FILE_PERMISSION_READ_BY_OTHERS))
return FILE_ERROR_FAILED;
+#endif
mounted_files_.insert(id);
@@ -559,7 +562,9 @@ bool FileCache::HasEnoughSpaceFor(int64 num_bytes,
free_space = base::SysInfo::AmountOfFreeDiskSpace(path);
// Subtract this as if this portion does not exist.
+#if defined(OS_CHROMEOS)
free_space -= cryptohome::kMinFreeSpaceInBytes;
+#endif
return (free_space >= num_bytes);
}

Powered by Google App Engine
This is Rietveld 408576698