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

Side by Side Diff: chrome/browser/chromeos/extensions/file_browser_private_api.cc

Issue 10877005: Rename GDataCache* to DriveCache* (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase. Created 8 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 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/extensions/file_browser_private_api.h" 5 #include "chrome/browser/chromeos/extensions/file_browser_private_api.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 GrantFilePermissionsToHost(render_view_host, 200 GrantFilePermissionsToHost(render_view_host,
201 mount_point, 201 mount_point,
202 file_handler_util::GetReadWritePermissions()); 202 file_handler_util::GetReadWritePermissions());
203 203
204 // Grant R/W permission for tmp and pinned cache folder. 204 // Grant R/W permission for tmp and pinned cache folder.
205 gdata::GDataSystemService* system_service = 205 gdata::GDataSystemService* system_service =
206 gdata::GDataSystemServiceFactory::GetForProfile(profile); 206 gdata::GDataSystemServiceFactory::GetForProfile(profile);
207 // |system_service| is NULL if incognito window / guest login. 207 // |system_service| is NULL if incognito window / guest login.
208 if (!system_service || !system_service->file_system()) 208 if (!system_service || !system_service->file_system())
209 return; 209 return;
210 gdata::GDataCache* cache = system_service->cache(); 210 gdata::DriveCache* cache = system_service->cache();
211 211
212 // We check permissions for raw cache file paths only for read-only 212 // We check permissions for raw cache file paths only for read-only
213 // operations (when fileEntry.file() is called), so read only permissions 213 // operations (when fileEntry.file() is called), so read only permissions
214 // should be sufficient for all cache paths. For the rest of supported 214 // should be sufficient for all cache paths. For the rest of supported
215 // operations the file access check is done for drive/ paths. 215 // operations the file access check is done for drive/ paths.
216 GrantFilePermissionsToHost(render_view_host, 216 GrantFilePermissionsToHost(render_view_host,
217 cache->GetCacheDirectoryPath( 217 cache->GetCacheDirectoryPath(
218 gdata::GDataCache::CACHE_TYPE_TMP), 218 gdata::DriveCache::CACHE_TYPE_TMP),
219 file_handler_util::GetReadOnlyPermissions()); 219 file_handler_util::GetReadOnlyPermissions());
220 GrantFilePermissionsToHost( 220 GrantFilePermissionsToHost(
221 render_view_host, 221 render_view_host,
222 cache->GetCacheDirectoryPath( 222 cache->GetCacheDirectoryPath(
223 gdata::GDataCache::CACHE_TYPE_PERSISTENT), 223 gdata::DriveCache::CACHE_TYPE_PERSISTENT),
224 file_handler_util::GetReadOnlyPermissions()); 224 file_handler_util::GetReadOnlyPermissions());
225 225
226 FilePath mount_point_virtual; 226 FilePath mount_point_virtual;
227 if (provider->GetVirtualPath(mount_point, &mount_point_virtual)) 227 if (provider->GetVirtualPath(mount_point, &mount_point_virtual))
228 provider->GrantFileAccessToExtension(extension_id, mount_point_virtual); 228 provider->GrantFileAccessToExtension(extension_id, mount_point_virtual);
229 } 229 }
230 230
231 // Given a file url, find the virtual FilePath associated with it. 231 // Given a file url, find the virtual FilePath associated with it.
232 FilePath GetVirtualPathFromURL(const GURL& file_url) { 232 FilePath GetVirtualPathFromURL(const GURL& file_url) {
233 fileapi::FileSystemURL url(file_url); 233 fileapi::FileSystemURL url(file_url);
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after
1070 if (!files.size()) { 1070 if (!files.size()) {
1071 SendResponse(false); 1071 SendResponse(false);
1072 return; 1072 return;
1073 } 1073 }
1074 1074
1075 const FilePath& source_path = files[0].local_path; 1075 const FilePath& source_path = files[0].local_path;
1076 const FilePath::StringType& display_name = files[0].display_name; 1076 const FilePath::StringType& display_name = files[0].display_name;
1077 // Check if the source path is under GData cache directory. 1077 // Check if the source path is under GData cache directory.
1078 gdata::GDataSystemService* system_service = 1078 gdata::GDataSystemService* system_service =
1079 gdata::GDataSystemServiceFactory::GetForProfile(profile_); 1079 gdata::GDataSystemServiceFactory::GetForProfile(profile_);
1080 gdata::GDataCache* cache = system_service ? system_service->cache() : NULL; 1080 gdata::DriveCache* cache = system_service ? system_service->cache() : NULL;
1081 if (cache && cache->IsUnderGDataCacheDirectory(source_path)) { 1081 if (cache && cache->IsUnderDriveCacheDirectory(source_path)) {
1082 cache->SetMountedStateOnUIThread( 1082 cache->SetMountedStateOnUIThread(
1083 source_path, 1083 source_path,
1084 true, 1084 true,
1085 base::Bind(&AddMountFunction::OnMountedStateSet, this, mount_type_str, 1085 base::Bind(&AddMountFunction::OnMountedStateSet, this, mount_type_str,
1086 display_name)); 1086 display_name));
1087 } else { 1087 } else {
1088 OnMountedStateSet(mount_type_str, display_name, 1088 OnMountedStateSet(mount_type_str, display_name,
1089 gdata::GDATA_FILE_OK, source_path); 1089 gdata::GDATA_FILE_OK, source_path);
1090 } 1090 }
1091 } 1091 }
(...skipping 1294 matching lines...) Expand 10 before | Expand all | Expand 10 after
2386 gdata::GDataSystemService* system_service = 2386 gdata::GDataSystemService* system_service =
2387 gdata::GDataSystemServiceFactory::GetForProfile(profile_); 2387 gdata::GDataSystemServiceFactory::GetForProfile(profile_);
2388 if (!system_service || !system_service->file_system()) 2388 if (!system_service || !system_service->file_system())
2389 return false; 2389 return false;
2390 2390
2391 FilePath directory_path = GetVirtualPathFromURL(GURL(file_url_as_string)); 2391 FilePath directory_path = GetVirtualPathFromURL(GURL(file_url_as_string));
2392 system_service->file_system()->RequestDirectoryRefresh(directory_path); 2392 system_service->file_system()->RequestDirectoryRefresh(directory_path);
2393 2393
2394 return true; 2394 return true;
2395 } 2395 }
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/extensions/file_browser_private_api.h ('k') | chrome/browser/chromeos/extensions/file_handler_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698