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