chromeos: Stop directly downloading files to the cache directory from DriveFileSystem::GetResolvedFile

Stop directly downloading files to cache directory, create temporary file instead.
Always free disk space from DriveCache::Store, regardless of the file operation type.

BUG=160487
TEST=unit_tests


Review URL: https://chromiumcodereview.appspot.com/13772005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@193007 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/chromeos/drive/drive_cache.cc b/chrome/browser/chromeos/drive/drive_cache.cc
index e719c203..489bdf9 100644
--- a/chrome/browser/chromeos/drive/drive_cache.cc
+++ b/chrome/browser/chromeos/drive/drive_cache.cc
@@ -581,17 +581,15 @@
     FileOperationType file_operation_type) {
   AssertOnSequencedWorkerPool();
 
+  int64 file_size = 0;
   if (file_operation_type == FILE_OPERATION_COPY) {
-    int64 file_size;
     if (!file_util::GetFileSize(source_path, &file_size)) {
       LOG(WARNING) << "Couldn't get file size for: " << source_path.value();
       return DRIVE_FILE_ERROR_FAILED;
     }
-
-    const bool enough_space = FreeDiskSpaceOnBlockingPoolIfNeededFor(file_size);
-    if (!enough_space)
-      return DRIVE_FILE_ERROR_NO_SPACE;
   }
+  if (!FreeDiskSpaceOnBlockingPoolIfNeededFor(file_size))
+    return DRIVE_FILE_ERROR_NO_SPACE;
 
   base::FilePath symlink_path;
   CacheSubDirectoryType sub_dir_type = CACHE_TYPE_TMP;