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 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/platform_file.h" | 13 #include "base/platform_file.h" |
| 14 #include "base/time.h" |
14 #include "chrome/browser/chromeos/gdata/gdata_errorcode.h" | 15 #include "chrome/browser/chromeos/gdata/gdata_errorcode.h" |
15 #include "googleurl/src/gurl.h" | 16 #include "googleurl/src/gurl.h" |
16 | 17 |
17 class FilePath; | 18 class FilePath; |
18 class Profile; | 19 class Profile; |
19 | 20 |
20 namespace gdata { | 21 namespace gdata { |
21 namespace util { | 22 namespace util { |
22 | 23 |
23 // Path constants. | 24 // Path constants. |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 std::string* resource_id, | 95 std::string* resource_id, |
95 std::string* md5, | 96 std::string* md5, |
96 std::string* extra_extension); | 97 std::string* extra_extension); |
97 | 98 |
98 // Returns true if Drive v2 API is enabled via commandline switch. | 99 // Returns true if Drive v2 API is enabled via commandline switch. |
99 bool IsDriveV2ApiEnabled(); | 100 bool IsDriveV2ApiEnabled(); |
100 | 101 |
101 // Returns a PlatformFileError that corresponds to the GDataFileError provided. | 102 // Returns a PlatformFileError that corresponds to the GDataFileError provided. |
102 base::PlatformFileError GDataFileErrorToPlatformError(GDataFileError error); | 103 base::PlatformFileError GDataFileErrorToPlatformError(GDataFileError error); |
103 | 104 |
104 // Returns true when time string is successfully parsed and output as |time|. | 105 // Parses an RFC 3339 date/time into a base::Time, returning true on success. |
105 // The time string must be in format yyyy-mm-ddThh:mm:ss.dddTZ (TZ is either | 106 // The time string must be in the format "yyyy-mm-ddThh:mm:ss.dddTZ" (TZ is |
106 // '+hh:mm', '-hh:mm', 'Z' (representing UTC) or empty string). | 107 // either '+hh:mm', '-hh:mm', 'Z' (representing UTC), or an empty string). |
107 bool GetTimeFromString(const base::StringPiece& raw_value, base::Time* time); | 108 bool GetTimeFromString(const base::StringPiece& raw_value, base::Time* time); |
108 | 109 |
| 110 // Formats a base::Time as an RFC 3339 date/time (in UTC). |
| 111 std::string FormatTimeAsString(const base::Time& time); |
| 112 |
109 } // namespace util | 113 } // namespace util |
110 } // namespace gdata | 114 } // namespace gdata |
111 | 115 |
112 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_UTIL_H_ | 116 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_UTIL_H_ |
OLD | NEW |