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 | 11 |
11 #include "googleurl/src/gurl.h" | 12 #include "googleurl/src/gurl.h" |
12 | 13 |
13 class FilePath; | 14 class FilePath; |
14 class Profile; | 15 class Profile; |
15 | 16 |
16 namespace gdata { | 17 namespace gdata { |
17 namespace util { | 18 namespace util { |
18 | 19 |
19 // Returns the GData mount point path, which looks like "/special/gdata". | 20 // Returns the GData mount point path, which looks like "/special/gdata". |
(...skipping 16 matching lines...) Expand all Loading... |
36 GURL* url); | 37 GURL* url); |
37 | 38 |
38 // Returns true if the given path is under the GData mount point. | 39 // Returns true if the given path is under the GData mount point. |
39 bool IsUnderGDataMountPoint(const FilePath& path); | 40 bool IsUnderGDataMountPoint(const FilePath& path); |
40 | 41 |
41 // Extracts the GData path from the given path located under the GData mount | 42 // Extracts the GData path from the given path located under the GData mount |
42 // point. Returns an empty path if |path| is not under the GData mount point. | 43 // point. Returns an empty path if |path| is not under the GData mount point. |
43 // Examples: ExtractGDatPath("/special/gdata/foo.txt") => "gdata/foo.txt" | 44 // Examples: ExtractGDatPath("/special/gdata/foo.txt") => "gdata/foo.txt" |
44 FilePath ExtractGDataPath(const FilePath& path); | 45 FilePath ExtractGDataPath(const FilePath& path); |
45 | 46 |
| 47 // Returns vector of all possible cache paths for a given path on gdata mount |
| 48 // point. |
| 49 void InsertGDataCachePathsPermissions( |
| 50 Profile* profile_, |
| 51 const FilePath& gdata_path, |
| 52 std::vector<std::pair<FilePath, int> >* cache_paths); |
| 53 |
46 // Grants read-only file access permissions to the process whose id is |pid| | 54 // Grants read-only file access permissions to the process whose id is |pid| |
47 // with ChildProcessSecurityPolicy for all possible cache paths that may be | 55 // with ChildProcessSecurityPolicy for all possible cache paths that may be |
48 // given to the specified file. | 56 // given to the specified file. |
49 void SetPermissionsForGDataCacheFiles(Profile* profile, | 57 void SetPermissionsForGDataCacheFiles(Profile* profile, |
50 int pid, | 58 int pid, |
51 const FilePath& path); | 59 const FilePath& path); |
52 | 60 |
53 // Returns true if gdata is currently active with the specified profile. | 61 // Returns true if gdata is currently active with the specified profile. |
54 bool IsGDataAvailable(Profile* profile); | 62 bool IsGDataAvailable(Profile* profile); |
55 } // namespace util | 63 } // namespace util |
56 } // namespace gdata | 64 } // namespace gdata |
57 | 65 |
58 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_UTIL_H_ | 66 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_UTIL_H_ |
OLD | NEW |