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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
233 Profile* profile, | 233 Profile* profile, |
234 const FilePath& gdata_path, | 234 const FilePath& gdata_path, |
235 std::vector<std::pair<FilePath, int> >* cache_paths ) { | 235 std::vector<std::pair<FilePath, int> >* cache_paths ) { |
236 DCHECK(cache_paths); | 236 DCHECK(cache_paths); |
237 | 237 |
238 GDataFileSystem* file_system = GetGDataFileSystem(profile); | 238 GDataFileSystem* file_system = GetGDataFileSystem(profile); |
239 if (!file_system) | 239 if (!file_system) |
240 return; | 240 return; |
241 | 241 |
242 GDataFileProperties file_properties; | 242 GDataFileProperties file_properties; |
243 file_system->GetFileInfoByPath(gdata_path, &file_properties); | 243 if (!file_system->GetFileInfoByPath(gdata_path, &file_properties)) |
244 return; | |
hshi1
2012/06/08 01:24:08
Nit: need 2-spaces indentation before "return;"
| |
244 | 245 |
245 std::string resource_id = file_properties.resource_id; | 246 std::string resource_id = file_properties.resource_id; |
246 std::string file_md5 = file_properties.file_md5; | 247 std::string file_md5 = file_properties.file_md5; |
247 | 248 |
248 // We check permissions for raw cache file paths only for read-only | 249 // We check permissions for raw cache file paths only for read-only |
249 // operations (when fileEntry.file() is called), so read only permissions | 250 // operations (when fileEntry.file() is called), so read only permissions |
250 // should be sufficient for all cache paths. For the rest of supported | 251 // should be sufficient for all cache paths. For the rest of supported |
251 // operations the file access check is done for drive/ paths. | 252 // operations the file access check is done for drive/ paths. |
252 cache_paths->push_back(std::make_pair( | 253 cache_paths->push_back(std::make_pair( |
253 file_system->GetCacheFilePath(resource_id, file_md5, | 254 file_system->GetCacheFilePath(resource_id, file_md5, |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
350 // Assign the extracted extensions to md5 and extra_extension. | 351 // Assign the extracted extensions to md5 and extra_extension. |
351 int extension_count = extensions.size(); | 352 int extension_count = extensions.size(); |
352 *md5 = (extension_count > 0) ? extensions[extension_count - 1] : | 353 *md5 = (extension_count > 0) ? extensions[extension_count - 1] : |
353 std::string(); | 354 std::string(); |
354 *extra_extension = (extension_count > 1) ? extensions[extension_count - 2] : | 355 *extra_extension = (extension_count > 1) ? extensions[extension_count - 2] : |
355 std::string(); | 356 std::string(); |
356 } | 357 } |
357 | 358 |
358 } // namespace util | 359 } // namespace util |
359 } // namespace gdata | 360 } // namespace gdata |
OLD | NEW |