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

Side by Side Diff: chrome/browser/chromeos/drive/file_cache.cc

Issue 89523002: Move Posix file utils to the base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chromeos/drive/file_cache.h" 5 #include "chrome/browser/chromeos/drive/file_cache.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/files/file_enumerator.h" 10 #include "base/files/file_enumerator.h"
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 // Get cache entry associated with the id and md5 238 // Get cache entry associated with the id and md5
239 FileCacheEntry cache_entry; 239 FileCacheEntry cache_entry;
240 if (!storage_->GetCacheEntry(id, &cache_entry)) 240 if (!storage_->GetCacheEntry(id, &cache_entry))
241 return FILE_ERROR_NOT_FOUND; 241 return FILE_ERROR_NOT_FOUND;
242 242
243 if (mounted_files_.count(id)) 243 if (mounted_files_.count(id))
244 return FILE_ERROR_INVALID_OPERATION; 244 return FILE_ERROR_INVALID_OPERATION;
245 245
246 // Ensure the file is readable to cros_disks. See crbug.com/236994. 246 // Ensure the file is readable to cros_disks. See crbug.com/236994.
247 base::FilePath path = GetCacheFilePath(id); 247 base::FilePath path = GetCacheFilePath(id);
248 if (!file_util::SetPosixFilePermissions( 248 if (!base::SetPosixFilePermissions(
249 path, 249 path,
250 file_util::FILE_PERMISSION_READ_BY_USER | 250 base::FILE_PERMISSION_READ_BY_USER |
251 file_util::FILE_PERMISSION_WRITE_BY_USER | 251 base::FILE_PERMISSION_WRITE_BY_USER |
252 file_util::FILE_PERMISSION_READ_BY_GROUP | 252 base::FILE_PERMISSION_READ_BY_GROUP |
253 file_util::FILE_PERMISSION_READ_BY_OTHERS)) 253 base::FILE_PERMISSION_READ_BY_OTHERS))
254 return FILE_ERROR_FAILED; 254 return FILE_ERROR_FAILED;
255 255
256 mounted_files_.insert(id); 256 mounted_files_.insert(id);
257 257
258 *cache_file_path = path; 258 *cache_file_path = path;
259 return FILE_ERROR_OK; 259 return FILE_ERROR_OK;
260 } 260 }
261 261
262 void FileCache::MarkAsUnmountedOnUIThread( 262 void FileCache::MarkAsUnmountedOnUIThread(
263 const base::FilePath& file_path, 263 const base::FilePath& file_path,
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 const std::string& id = GetIdFromPath(new_path); 586 const std::string& id = GetIdFromPath(new_path);
587 new_path = GetCacheFilePath(util::CanonicalizeResourceId(id)); 587 new_path = GetCacheFilePath(util::CanonicalizeResourceId(id));
588 if (new_path != current && !base::Move(current, new_path)) 588 if (new_path != current && !base::Move(current, new_path))
589 return false; 589 return false;
590 } 590 }
591 return true; 591 return true;
592 } 592 }
593 593
594 } // namespace internal 594 } // namespace internal
595 } // namespace drive 595 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698