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 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 base::PlatformFileError GDataFileErrorToPlatformError(GDataFileError error); | 103 base::PlatformFileError GDataFileErrorToPlatformError(GDataFileError error); |
104 | 104 |
105 // Parses an RFC 3339 date/time into a base::Time, returning true on success. | 105 // Parses an RFC 3339 date/time into a base::Time, returning true on success. |
106 // The time string must be in the format "yyyy-mm-ddThh:mm:ss.dddTZ" (TZ is | 106 // The time string must be in the format "yyyy-mm-ddThh:mm:ss.dddTZ" (TZ is |
107 // either '+hh:mm', '-hh:mm', 'Z' (representing UTC), or an empty string). | 107 // either '+hh:mm', '-hh:mm', 'Z' (representing UTC), or an empty string). |
108 bool GetTimeFromString(const base::StringPiece& raw_value, base::Time* time); | 108 bool GetTimeFromString(const base::StringPiece& raw_value, base::Time* time); |
109 | 109 |
110 // Formats a base::Time as an RFC 3339 date/time (in UTC). | 110 // Formats a base::Time as an RFC 3339 date/time (in UTC). |
111 std::string FormatTimeAsString(const base::Time& time); | 111 std::string FormatTimeAsString(const base::Time& time); |
112 | 112 |
| 113 // Callback type for PrepareWritableFilePathAndRun. |
| 114 typedef base::Callback<void (GDataFileError, const FilePath& path)> |
| 115 OpenFileCallback; |
| 116 |
| 117 // Invokes |callback| on blocking thread pool, after converting virtual |path| |
| 118 // string like "/special/drive/foo.txt" to the concrete local cache file path. |
| 119 // After |callback| returns, the written content is synchronized to the server. |
| 120 // |
| 121 // If |path| is not a GData path, it is regarded as a local path and no path |
| 122 // conversion takes place. |
| 123 void PrepareWritableFileAndRun(Profile* profile, |
| 124 const FilePath& path, |
| 125 const OpenFileCallback& callback); |
| 126 |
113 } // namespace util | 127 } // namespace util |
114 } // namespace gdata | 128 } // namespace gdata |
115 | 129 |
116 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_UTIL_H_ | 130 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_UTIL_H_ |
OLD | NEW |