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> |
11 | 11 |
| 12 #include "base/memory/scoped_ptr.h" |
12 #include "googleurl/src/gurl.h" | 13 #include "googleurl/src/gurl.h" |
13 | 14 |
14 class FilePath; | 15 class FilePath; |
15 class Profile; | 16 class Profile; |
16 | 17 |
17 namespace gdata { | 18 namespace gdata { |
18 namespace util { | 19 namespace util { |
19 | 20 |
20 // Search path is a path used to display gdata content search results. | 21 // Search path is a path used to display gdata content search results. |
21 // All results are displayed under virtual directory "drive/.search", in which | 22 // All results are displayed under virtual directory "drive/.search", in which |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 // If the path is not search path, the behaviour is not defined. | 71 // If the path is not search path, the behaviour is not defined. |
71 bool ParseSearchFileName(const std::string& search_file_name, | 72 bool ParseSearchFileName(const std::string& search_file_name, |
72 std::string* resource_id, | 73 std::string* resource_id, |
73 std::string* original_file_name); | 74 std::string* original_file_name); |
74 | 75 |
75 // Extracts the GData path from the given path located under the GData mount | 76 // Extracts the GData path from the given path located under the GData mount |
76 // point. Returns an empty path if |path| is not under the GData mount point. | 77 // point. Returns an empty path if |path| is not under the GData mount point. |
77 // Examples: ExtractGDatPath("/special/drive/foo.txt") => "drive/foo.txt" | 78 // Examples: ExtractGDatPath("/special/drive/foo.txt") => "drive/foo.txt" |
78 FilePath ExtractGDataPath(const FilePath& path); | 79 FilePath ExtractGDataPath(const FilePath& path); |
79 | 80 |
80 // Returns vector of all possible cache paths for a given path on gdata mount | 81 // Inserts all possible cache paths for a given vector of paths on gdata mount |
81 // point. | 82 // point into the output vector |cache_paths|. |
82 void InsertGDataCachePathsPermissions( | 83 void InsertGDataCachePathsPermissions( |
83 Profile* profile_, | 84 Profile* profile_, |
84 const FilePath& gdata_path, | 85 scoped_ptr<std::vector<FilePath> > gdata_paths, |
85 std::vector<std::pair<FilePath, int> >* cache_paths); | 86 std::vector<std::pair<FilePath, int> >* cache_paths, |
| 87 const base::Closure& callback); |
86 | 88 |
87 // Returns true if gdata is currently active with the specified profile. | 89 // Returns true if gdata is currently active with the specified profile. |
88 bool IsGDataAvailable(Profile* profile); | 90 bool IsGDataAvailable(Profile* profile); |
89 | 91 |
90 // Escapes a file name in GData cache. | 92 // Escapes a file name in GData cache. |
91 // Replaces percent ('%'), period ('.') and slash ('/') with %XX (hex) | 93 // Replaces percent ('%'), period ('.') and slash ('/') with %XX (hex) |
92 std::string EscapeCacheFileName(const std::string& filename); | 94 std::string EscapeCacheFileName(const std::string& filename); |
93 | 95 |
94 // Unescapes a file path in GData cache. | 96 // Unescapes a file path in GData cache. |
95 // This is the inverse of EscapeCacheFileName. | 97 // This is the inverse of EscapeCacheFileName. |
(...skipping 10 matching lines...) Expand all Loading... |
106 // Example: path="/user/GCache/v1/persistent/pdf:a1b2.01234567.mounted" => | 108 // Example: path="/user/GCache/v1/persistent/pdf:a1b2.01234567.mounted" => |
107 // resource_id="pdf:a1b2", md5="01234567", extra_extension="mounted". | 109 // resource_id="pdf:a1b2", md5="01234567", extra_extension="mounted". |
108 void ParseCacheFilePath(const FilePath& path, | 110 void ParseCacheFilePath(const FilePath& path, |
109 std::string* resource_id, | 111 std::string* resource_id, |
110 std::string* md5, | 112 std::string* md5, |
111 std::string* extra_extension); | 113 std::string* extra_extension); |
112 } // namespace util | 114 } // namespace util |
113 } // namespace gdata | 115 } // namespace gdata |
114 | 116 |
115 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_UTIL_H_ | 117 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_UTIL_H_ |
OLD | NEW |