| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_UTIL_H_ | |
| 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_UTIL_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/callback_forward.h" | |
| 11 #include "base/platform_file.h" | |
| 12 #include "chrome/browser/google_apis/gdata_errorcode.h" | |
| 13 | |
| 14 class FilePath; | |
| 15 class Profile; | |
| 16 | |
| 17 namespace base { | |
| 18 class SequencedTaskRunner; | |
| 19 class Time; | |
| 20 } // namespace base | |
| 21 | |
| 22 namespace tracked_objects { | |
| 23 class Location; | |
| 24 } // tracked_objects | |
| 25 | |
| 26 namespace gdata { | |
| 27 namespace util { | |
| 28 | |
| 29 // Returns true if gdata is currently active with the specified profile. | |
| 30 bool IsGDataAvailable(Profile* profile); | |
| 31 | |
| 32 // Returns true if Drive v2 API is enabled via commandline switch. | |
| 33 bool IsDriveV2ApiEnabled(); | |
| 34 | |
| 35 // Returns a PlatformFileError that corresponds to the DriveFileError provided. | |
| 36 base::PlatformFileError DriveFileErrorToPlatformError(DriveFileError error); | |
| 37 | |
| 38 // Parses an RFC 3339 date/time into a base::Time, returning true on success. | |
| 39 // The time string must be in the format "yyyy-mm-ddThh:mm:ss.dddTZ" (TZ is | |
| 40 // either '+hh:mm', '-hh:mm', 'Z' (representing UTC), or an empty string). | |
| 41 bool GetTimeFromString(const base::StringPiece& raw_value, base::Time* time); | |
| 42 | |
| 43 // Formats a base::Time as an RFC 3339 date/time (in UTC). | |
| 44 std::string FormatTimeAsString(const base::Time& time); | |
| 45 // Formats a base::Time as an RFC 3339 date/time (in localtime). | |
| 46 std::string FormatTimeAsStringLocaltime(const base::Time& time); | |
| 47 | |
| 48 // Wrapper around BrowserThread::PostTask to post a task to the blocking | |
| 49 // pool with the given sequence token. | |
| 50 void PostBlockingPoolSequencedTask( | |
| 51 const tracked_objects::Location& from_here, | |
| 52 base::SequencedTaskRunner* blocking_task_runner, | |
| 53 const base::Closure& task); | |
| 54 | |
| 55 // Similar to PostBlockingPoolSequencedTask() but this one takes a reply | |
| 56 // callback that runs on the calling thread. | |
| 57 void PostBlockingPoolSequencedTaskAndReply( | |
| 58 const tracked_objects::Location& from_here, | |
| 59 base::SequencedTaskRunner* blocking_task_runner, | |
| 60 const base::Closure& request_task, | |
| 61 const base::Closure& reply_task); | |
| 62 | |
| 63 } // namespace util | |
| 64 } // namespace gdata | |
| 65 | |
| 66 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_UTIL_H_ | |
| OLD | NEW |