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

Side by Side Diff: chrome/browser/chromeos/gdata/gdata_file_system.cc

Issue 9808023: Grant file access permissions for cached file paths to file browsers/handlers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: another rebase Created 8 years, 9 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 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/gdata/gdata_file_system.h" 5 #include "chrome/browser/chromeos/gdata/gdata_file_system.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after
1090 } 1090 }
1091 1091
1092 FilePath GDataFileSystem::GetGDataTempDownloadFolderPath() const { 1092 FilePath GDataFileSystem::GetGDataTempDownloadFolderPath() const {
1093 return cache_paths_[GDataRootDirectory::CACHE_TYPE_TMP_DOWNLOADS]; 1093 return cache_paths_[GDataRootDirectory::CACHE_TYPE_TMP_DOWNLOADS];
1094 } 1094 }
1095 1095
1096 FilePath GDataFileSystem::GetGDataCachePinnedDirectory() const { 1096 FilePath GDataFileSystem::GetGDataCachePinnedDirectory() const {
1097 return cache_paths_[GDataRootDirectory::CACHE_TYPE_PINNED]; 1097 return cache_paths_[GDataRootDirectory::CACHE_TYPE_PINNED];
1098 } 1098 }
1099 1099
1100 FilePath GDataFileSystem::GetGDataCachePersistentDirectory() const {
1101 return cache_paths_[GDataRootDirectory::CACHE_TYPE_PERSISTENT];
1102 }
1103
1100 GDataFileBase* GDataFileSystem::GetGDataFileInfoFromPath( 1104 GDataFileBase* GDataFileSystem::GetGDataFileInfoFromPath(
1101 const FilePath& file_path) { 1105 const FilePath& file_path) {
1102 lock_.AssertAcquired(); 1106 lock_.AssertAcquired();
1103 // Find directory element within the cached file system snapshot. 1107 // Find directory element within the cached file system snapshot.
1104 ReadOnlyFindFileDelegate find_delegate; 1108 ReadOnlyFindFileDelegate find_delegate;
1105 UnsafeFindFileByPath(file_path, &find_delegate); 1109 UnsafeFindFileByPath(file_path, &find_delegate);
1106 return find_delegate.file(); 1110 return find_delegate.file();
1107 } 1111 }
1108 1112
1109 void GDataFileSystem::GetFromCacheForPath( 1113 void GDataFileSystem::GetFromCacheForPath(
(...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after
1976 StoreToCache(resource_id, md5, file_content_path, CacheOperationCallback()); 1980 StoreToCache(resource_id, md5, file_content_path, CacheOperationCallback());
1977 } 1981 }
1978 1982
1979 1983
1980 //===================== GDataFileSystem: Cache entry points ==================== 1984 //===================== GDataFileSystem: Cache entry points ====================
1981 1985
1982 FilePath GDataFileSystem::GetCacheFilePath( 1986 FilePath GDataFileSystem::GetCacheFilePath(
1983 const std::string& resource_id, 1987 const std::string& resource_id,
1984 const std::string& md5, 1988 const std::string& md5,
1985 GDataRootDirectory::CacheSubDirectoryType sub_dir_type, 1989 GDataRootDirectory::CacheSubDirectoryType sub_dir_type,
1986 CachedFileOrigin file_origin) { 1990 CachedFileOrigin file_origin) const {
1987 DCHECK(sub_dir_type != GDataRootDirectory::CACHE_TYPE_META); 1991 DCHECK(sub_dir_type != GDataRootDirectory::CACHE_TYPE_META);
1992
1988 // Runs on any thread. 1993 // Runs on any thread.
1989 // Filename is formatted as resource_id.md5, i.e. resource_id is the base 1994 // Filename is formatted as resource_id.md5, i.e. resource_id is the base
1990 // name and md5 is the extension. 1995 // name and md5 is the extension.
1991 std::string base_name = GDataFileBase::EscapeUtf8FileName(resource_id); 1996 std::string base_name = GDataFileBase::EscapeUtf8FileName(resource_id);
1992 if (file_origin == CACHED_FILE_LOCALLY_MODIFIED) { 1997 if (file_origin == CACHED_FILE_LOCALLY_MODIFIED) {
1993 DCHECK(sub_dir_type == GDataRootDirectory::CACHE_TYPE_PERSISTENT); 1998 DCHECK(sub_dir_type == GDataRootDirectory::CACHE_TYPE_PERSISTENT);
1994 base_name += FilePath::kExtensionSeparator; 1999 base_name += FilePath::kExtensionSeparator;
1995 base_name += kLocallyModifiedFileExtension; 2000 base_name += kLocallyModifiedFileExtension;
1996 } else if (!md5.empty()) { 2001 } else if (!md5.empty()) {
1997 base_name += FilePath::kExtensionSeparator; 2002 base_name += FilePath::kExtensionSeparator;
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
2651 const base::Closure& task) { 2656 const base::Closure& task) {
2652 return BrowserThread::PostBlockingPoolSequencedTask( 2657 return BrowserThread::PostBlockingPoolSequencedTask(
2653 sequence_token_name, 2658 sequence_token_name,
2654 from_here, 2659 from_here,
2655 base::Bind(&GDataFileSystem::RunTaskOnIOThreadPool, 2660 base::Bind(&GDataFileSystem::RunTaskOnIOThreadPool,
2656 base::Unretained(this), 2661 base::Unretained(this),
2657 task)); 2662 task));
2658 } 2663 }
2659 2664
2660 } // namespace gdata 2665 } // namespace gdata
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_file_system.h ('k') | chrome/browser/chromeos/gdata/gdata_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698