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

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

Issue 10545084: Move chromeos::GDataFileSystem::GetCacheDirectoryPath and GetCacheFilePath implementation to GDataC… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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_util.h" 5 #include "chrome/browser/chromeos/gdata/gdata_util.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 244
245 std::string resource_id = file_properties.resource_id; 245 std::string resource_id = file_properties.resource_id;
246 std::string file_md5 = file_properties.file_md5; 246 std::string file_md5 = file_properties.file_md5;
247 247
248 // We check permissions for raw cache file paths only for read-only 248 // We check permissions for raw cache file paths only for read-only
249 // operations (when fileEntry.file() is called), so read only permissions 249 // operations (when fileEntry.file() is called), so read only permissions
250 // should be sufficient for all cache paths. For the rest of supported 250 // should be sufficient for all cache paths. For the rest of supported
251 // operations the file access check is done for drive/ paths. 251 // operations the file access check is done for drive/ paths.
252 cache_paths->push_back(std::make_pair( 252 cache_paths->push_back(std::make_pair(
253 file_system->GetCacheFilePath(resource_id, file_md5, 253 file_system->GetCacheFilePath(resource_id, file_md5,
254 GDataCache::CACHE_TYPE_PERSISTENT, 254 GDataCache::CACHE_TYPE_PERSISTENT,
255 GDataFileSystem::CACHED_FILE_FROM_SERVER), 255 GDataCache::CACHED_FILE_FROM_SERVER),
256 kReadOnlyFilePermissions)); 256 kReadOnlyFilePermissions));
257 // TODO(tbarzic): When we start supporting openFile operation, we may have to 257 // TODO(tbarzic): When we start supporting openFile operation, we may have to
258 // change permission for localy modified files to match handler's permissions. 258 // change permission for localy modified files to match handler's permissions.
259 cache_paths->push_back(std::make_pair( 259 cache_paths->push_back(std::make_pair(
260 file_system->GetCacheFilePath(resource_id, file_md5, 260 file_system->GetCacheFilePath(resource_id, file_md5,
261 GDataCache::CACHE_TYPE_PERSISTENT, 261 GDataCache::CACHE_TYPE_PERSISTENT,
262 GDataFileSystem::CACHED_FILE_LOCALLY_MODIFIED), 262 GDataCache::CACHED_FILE_LOCALLY_MODIFIED),
263 kReadOnlyFilePermissions)); 263 kReadOnlyFilePermissions));
264 cache_paths->push_back(std::make_pair( 264 cache_paths->push_back(std::make_pair(
265 file_system->GetCacheFilePath(resource_id, file_md5, 265 file_system->GetCacheFilePath(resource_id, file_md5,
266 GDataCache::CACHE_TYPE_PERSISTENT, 266 GDataCache::CACHE_TYPE_PERSISTENT,
267 GDataFileSystem::CACHED_FILE_MOUNTED), 267 GDataCache::CACHED_FILE_MOUNTED),
268 kReadOnlyFilePermissions)); 268 kReadOnlyFilePermissions));
269 cache_paths->push_back(std::make_pair( 269 cache_paths->push_back(std::make_pair(
270 file_system->GetCacheFilePath(resource_id, file_md5, 270 file_system->GetCacheFilePath(resource_id, file_md5,
271 GDataCache::CACHE_TYPE_TMP, 271 GDataCache::CACHE_TYPE_TMP,
272 GDataFileSystem::CACHED_FILE_FROM_SERVER), 272 GDataCache::CACHED_FILE_FROM_SERVER),
273 kReadOnlyFilePermissions)); 273 kReadOnlyFilePermissions));
274 } 274 }
275 275
276 bool IsGDataAvailable(Profile* profile) { 276 bool IsGDataAvailable(Profile* profile) {
277 if (!chromeos::UserManager::Get()->IsUserLoggedIn() || 277 if (!chromeos::UserManager::Get()->IsUserLoggedIn() ||
278 chromeos::UserManager::Get()->IsLoggedInAsGuest() || 278 chromeos::UserManager::Get()->IsLoggedInAsGuest() ||
279 chromeos::UserManager::Get()->IsLoggedInAsDemoUser()) 279 chromeos::UserManager::Get()->IsLoggedInAsDemoUser())
280 return false; 280 return false;
281 281
282 // Do not allow GData for incognito windows / guest mode. 282 // Do not allow GData for incognito windows / guest mode.
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 // Assign the extracted extensions to md5 and extra_extension. 350 // Assign the extracted extensions to md5 and extra_extension.
351 int extension_count = extensions.size(); 351 int extension_count = extensions.size();
352 *md5 = (extension_count > 0) ? extensions[extension_count - 1] : 352 *md5 = (extension_count > 0) ? extensions[extension_count - 1] :
353 std::string(); 353 std::string();
354 *extra_extension = (extension_count > 1) ? extensions[extension_count - 2] : 354 *extra_extension = (extension_count > 1) ? extensions[extension_count - 2] :
355 std::string(); 355 std::string();
356 } 356 }
357 357
358 } // namespace util 358 } // namespace util
359 } // namespace gdata 359 } // namespace gdata
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698