| 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 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_UTIL_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_UTIL_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_UTIL_H_ | 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_UTIL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 | 55 |
| 56 // Grants read-only file access permissions to the process whose id is |pid| | 56 // Grants read-only file access permissions to the process whose id is |pid| |
| 57 // with ChildProcessSecurityPolicy for all possible cache paths that may be | 57 // with ChildProcessSecurityPolicy for all possible cache paths that may be |
| 58 // given to the specified file. | 58 // given to the specified file. |
| 59 void SetPermissionsForGDataCacheFiles(Profile* profile, | 59 void SetPermissionsForGDataCacheFiles(Profile* profile, |
| 60 int pid, | 60 int pid, |
| 61 const FilePath& path); | 61 const FilePath& path); |
| 62 | 62 |
| 63 // Returns true if gdata is currently active with the specified profile. | 63 // Returns true if gdata is currently active with the specified profile. |
| 64 bool IsGDataAvailable(Profile* profile); | 64 bool IsGDataAvailable(Profile* profile); |
| 65 |
| 66 // Extracts resource_id, md5, and extra_extension from cache path. |
| 67 // Case 1: Pinned and outgoing symlinks only have resource_id. |
| 68 // Example: path="/user/GCache/v1/pinned/pdf:a1b2" => |
| 69 // resource_id="pdf:a1b2", md5="", extra_extension=""; |
| 70 // Case 2: Normal files have both resource_id and md5. |
| 71 // Example: path="/user/GCache/v1/tmp/pdf:a1b2.01234567" => |
| 72 // resource_id="pdf:a1b2", md5="01234567", extra_extension=""; |
| 73 // Case 3: Mounted files have all three parts. |
| 74 // Example: path="/user/GCache/v1/persistent/pdf:a1b2.01234567.mounted" => |
| 75 // resource_id="pdf:a1b2", md5="01234567", extra_extension="mounted". |
| 76 void ParseCacheFilePath(const FilePath& path, |
| 77 std::string* resource_id, |
| 78 std::string* md5, |
| 79 std::string* extra_extension); |
| 65 } // namespace util | 80 } // namespace util |
| 66 } // namespace gdata | 81 } // namespace gdata |
| 67 | 82 |
| 68 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_UTIL_H_ | 83 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_UTIL_H_ |
| OLD | NEW |