| OLD | NEW |
| 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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 GDataFileSystem::CACHED_FILE_MOUNTED), | 228 GDataFileSystem::CACHED_FILE_MOUNTED), |
| 229 kReadOnlyFilePermissions)); | 229 kReadOnlyFilePermissions)); |
| 230 cache_paths->push_back(std::make_pair( | 230 cache_paths->push_back(std::make_pair( |
| 231 file_system->GetCacheFilePath(resource_id, file_md5, | 231 file_system->GetCacheFilePath(resource_id, file_md5, |
| 232 GDataRootDirectory::CACHE_TYPE_TMP, | 232 GDataRootDirectory::CACHE_TYPE_TMP, |
| 233 GDataFileSystem::CACHED_FILE_FROM_SERVER), | 233 GDataFileSystem::CACHED_FILE_FROM_SERVER), |
| 234 kReadOnlyFilePermissions)); | 234 kReadOnlyFilePermissions)); |
| 235 | 235 |
| 236 } | 236 } |
| 237 | 237 |
| 238 void SetPermissionsForGDataCacheFiles(Profile* profile, | |
| 239 int pid, | |
| 240 const FilePath& path) { | |
| 241 std::vector<std::pair<FilePath, int> > cache_paths; | |
| 242 InsertGDataCachePathsPermissions(profile, path, &cache_paths); | |
| 243 for (size_t i = 0; i < cache_paths.size(); i++) { | |
| 244 content::ChildProcessSecurityPolicy::GetInstance()->GrantPermissionsForFile( | |
| 245 pid, cache_paths[i].first, cache_paths[i].second); | |
| 246 } | |
| 247 } | |
| 248 | |
| 249 bool IsGDataAvailable(Profile* profile) { | 238 bool IsGDataAvailable(Profile* profile) { |
| 250 // Do not allow GData for incognito windows / guest mode. | 239 // Do not allow GData for incognito windows / guest mode. |
| 251 if (profile->IsOffTheRecord()) | 240 if (profile->IsOffTheRecord()) |
| 252 return false; | 241 return false; |
| 253 | 242 |
| 254 // Disable gdata if preference is set. This can happen with commandline flag | 243 // Disable gdata if preference is set. This can happen with commandline flag |
| 255 // --disable-gdata or enterprise policy, or probably with user settings too | 244 // --disable-gdata or enterprise policy, or probably with user settings too |
| 256 // in the future. | 245 // in the future. |
| 257 if (profile->GetPrefs()->GetBoolean(prefs::kDisableGData)) | 246 if (profile->GetPrefs()->GetBoolean(prefs::kDisableGData)) |
| 258 return false; | 247 return false; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 // Assign the extracted extensions to md5 and extra_extension. | 307 // Assign the extracted extensions to md5 and extra_extension. |
| 319 int extension_count = extensions.size(); | 308 int extension_count = extensions.size(); |
| 320 *md5 = (extension_count > 0) ? extensions[extension_count - 1] : | 309 *md5 = (extension_count > 0) ? extensions[extension_count - 1] : |
| 321 std::string(); | 310 std::string(); |
| 322 *extra_extension = (extension_count > 1) ? extensions[extension_count - 2] : | 311 *extra_extension = (extension_count > 1) ? extensions[extension_count - 2] : |
| 323 std::string(); | 312 std::string(); |
| 324 } | 313 } |
| 325 | 314 |
| 326 } // namespace util | 315 } // namespace util |
| 327 } // namespace gdata | 316 } // namespace gdata |
| OLD | NEW |