| 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 | 10 |
| 11 class FilePath; | 11 class FilePath; |
| 12 class Profile; |
| 12 | 13 |
| 13 namespace gdata { | 14 namespace gdata { |
| 14 namespace util { | 15 namespace util { |
| 15 | 16 |
| 16 // Returns the GData mount point path, which looks like "/special/gdata". | 17 // Returns the GData mount point path, which looks like "/special/gdata". |
| 17 const FilePath& GetGDataMountPointPath(); | 18 const FilePath& GetGDataMountPointPath(); |
| 18 | 19 |
| 19 // Returns the GData mount path as string. | 20 // Returns the GData mount path as string. |
| 20 const std::string& GetGDataMountPointPathAsString(); | 21 const std::string& GetGDataMountPointPathAsString(); |
| 21 | 22 |
| 22 // Returns true if the given path is under the GData mount point. | 23 // Returns true if the given path is under the GData mount point. |
| 23 bool IsUnderGDataMountPoint(const FilePath& path); | 24 bool IsUnderGDataMountPoint(const FilePath& path); |
| 24 | 25 |
| 25 // Extracts the GData path from the given path located under the GData mount | 26 // Extracts the GData path from the given path located under the GData mount |
| 26 // point. Returns an empty path if |path| is not under the GData mount point. | 27 // point. Returns an empty path if |path| is not under the GData mount point. |
| 27 // Examples: ExtractGDatPath("/special/gdata/foo.txt") => "gdata/foo.txt" | 28 // Examples: ExtractGDatPath("/special/gdata/foo.txt") => "gdata/foo.txt" |
| 28 FilePath ExtractGDataPath(const FilePath& path); | 29 FilePath ExtractGDataPath(const FilePath& path); |
| 29 | 30 |
| 31 // Grants read-only file access permissions to the process whose id is |pid| |
| 32 // with ChildProcessSecurityPolicy for all possible cache paths that may be |
| 33 // given to the specified file. |
| 34 void SetPermissionsForGDataCacheFiles(Profile* profile, |
| 35 int pid, |
| 36 const FilePath& path); |
| 30 } // namespace util | 37 } // namespace util |
| 31 } // namespace gdata | 38 } // namespace gdata |
| 32 | 39 |
| 33 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_UTIL_H_ | 40 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_UTIL_H_ |
| OLD | NEW |