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

Unified Diff: components/drive/file_cache.cc

Issue 1296483003: Move chrome/browser/chromeos/drive/resource* (+deps) into components/drive. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebasing... Created 5 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 | « components/drive/file_cache.h ('k') | components/drive/file_cache_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 9ffd827bb56f8e0929ea9a377a9240cce7897879..749dd8f7cd185cbcfe9206741e830a38c6c39c85 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/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,10 @@ 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_CHROMEOS)
+ // Ensure the file is readable to cros_disks. See crbug.com/236994.
if (!base::SetPosixFilePermissions(
path,
base::FILE_PERMISSION_READ_BY_USER |
@@ -252,6 +255,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 +563,12 @@ bool FileCache::HasEnoughSpaceFor(int64 num_bytes,
free_space = base::SysInfo::AmountOfFreeDiskSpace(path);
// Subtract this as if this portion does not exist.
- free_space -= cryptohome::kMinFreeSpaceInBytes;
+#if defined(OS_CHROMEOS)
+ const int64 kMinFreeBytes = cryptohome::kMinFreeSpaceInBytes;
+#else
+ const int64 kMinFreeBytes = 512ull * 1024ull * 1024ull; // 512MB
+#endif
+ free_space -= kMinFreeBytes;
return (free_space >= num_bytes);
}
« no previous file with comments | « components/drive/file_cache.h ('k') | components/drive/file_cache_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698