Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Side by Side Diff: chrome/browser/chromeos/gdata/gdata_util.h

Issue 10877006: Rename GDataErrorCode to DriveErrorCode, GDataFileError to DriveFileError (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: minor local variable name fix. Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 // Example: path="/user/GCache/v1/persistent/pdf:a1b2.01234567.mounted" => 101 // Example: path="/user/GCache/v1/persistent/pdf:a1b2.01234567.mounted" =>
102 // resource_id="pdf:a1b2", md5="01234567", extra_extension="mounted". 102 // resource_id="pdf:a1b2", md5="01234567", extra_extension="mounted".
103 void ParseCacheFilePath(const FilePath& path, 103 void ParseCacheFilePath(const FilePath& path,
104 std::string* resource_id, 104 std::string* resource_id,
105 std::string* md5, 105 std::string* md5,
106 std::string* extra_extension); 106 std::string* extra_extension);
107 107
108 // Returns true if Drive v2 API is enabled via commandline switch. 108 // Returns true if Drive v2 API is enabled via commandline switch.
109 bool IsDriveV2ApiEnabled(); 109 bool IsDriveV2ApiEnabled();
110 110
111 // Returns a PlatformFileError that corresponds to the GDataFileError provided. 111 // Returns a PlatformFileError that corresponds to the DriveFileError provided.
112 base::PlatformFileError GDataFileErrorToPlatformError(GDataFileError error); 112 base::PlatformFileError DriveFileErrorToPlatformError(DriveFileError error);
113 113
114 // Parses an RFC 3339 date/time into a base::Time, returning true on success. 114 // Parses an RFC 3339 date/time into a base::Time, returning true on success.
115 // The time string must be in the format "yyyy-mm-ddThh:mm:ss.dddTZ" (TZ is 115 // The time string must be in the format "yyyy-mm-ddThh:mm:ss.dddTZ" (TZ is
116 // either '+hh:mm', '-hh:mm', 'Z' (representing UTC), or an empty string). 116 // either '+hh:mm', '-hh:mm', 'Z' (representing UTC), or an empty string).
117 bool GetTimeFromString(const base::StringPiece& raw_value, base::Time* time); 117 bool GetTimeFromString(const base::StringPiece& raw_value, base::Time* time);
118 118
119 // Formats a base::Time as an RFC 3339 date/time (in UTC). 119 // Formats a base::Time as an RFC 3339 date/time (in UTC).
120 std::string FormatTimeAsString(const base::Time& time); 120 std::string FormatTimeAsString(const base::Time& time);
121 // Formats a base::Time as an RFC 3339 date/time (in localtime). 121 // Formats a base::Time as an RFC 3339 date/time (in localtime).
122 std::string FormatTimeAsStringLocaltime(const base::Time& time); 122 std::string FormatTimeAsStringLocaltime(const base::Time& time);
123 123
124 // Callback type for PrepareWritableFilePathAndRun. 124 // Callback type for PrepareWritableFilePathAndRun.
125 typedef base::Callback<void (GDataFileError, const FilePath& path)> 125 typedef base::Callback<void (DriveFileError, const FilePath& path)>
126 OpenFileCallback; 126 OpenFileCallback;
127 127
128 // Invokes |callback| on blocking thread pool, after converting virtual |path| 128 // Invokes |callback| on blocking thread pool, after converting virtual |path|
129 // string like "/special/drive/foo.txt" to the concrete local cache file path. 129 // string like "/special/drive/foo.txt" to the concrete local cache file path.
130 // After |callback| returns, the written content is synchronized to the server. 130 // After |callback| returns, the written content is synchronized to the server.
131 // 131 //
132 // If |path| is not a GData path, it is regarded as a local path and no path 132 // If |path| is not a GData path, it is regarded as a local path and no path
133 // conversion takes place. 133 // conversion takes place.
134 // 134 //
135 // Must be called from UI thread. 135 // Must be called from UI thread.
136 void PrepareWritableFileAndRun(Profile* profile, 136 void PrepareWritableFileAndRun(Profile* profile,
137 const FilePath& path, 137 const FilePath& path,
138 const OpenFileCallback& callback); 138 const OpenFileCallback& callback);
139 139
140 // Converts gdata error code into file platform error code. 140 // Converts GData error code into file platform error code.
141 GDataFileError GDataToGDataFileError(GDataErrorCode status); 141 DriveFileError GDataToDriveFileError(GDataErrorCode status);
142 142
143 // Wrapper around BrowserThread::PostTask to post a task to the blocking 143 // Wrapper around BrowserThread::PostTask to post a task to the blocking
144 // pool with the given sequence token. 144 // pool with the given sequence token.
145 void PostBlockingPoolSequencedTask( 145 void PostBlockingPoolSequencedTask(
146 const tracked_objects::Location& from_here, 146 const tracked_objects::Location& from_here,
147 base::SequencedTaskRunner* blocking_task_runner, 147 base::SequencedTaskRunner* blocking_task_runner,
148 const base::Closure& task); 148 const base::Closure& task);
149 149
150 // Similar to PostBlockingPoolSequencedTask() but this one takes a reply 150 // Similar to PostBlockingPoolSequencedTask() but this one takes a reply
151 // callback that runs on the calling thread. 151 // callback that runs on the calling thread.
152 void PostBlockingPoolSequencedTaskAndReply( 152 void PostBlockingPoolSequencedTaskAndReply(
153 const tracked_objects::Location& from_here, 153 const tracked_objects::Location& from_here,
154 base::SequencedTaskRunner* blocking_task_runner, 154 base::SequencedTaskRunner* blocking_task_runner,
155 const base::Closure& request_task, 155 const base::Closure& request_task,
156 const base::Closure& reply_task); 156 const base::Closure& reply_task);
157 157
158 } // namespace util 158 } // namespace util
159 } // namespace gdata 159 } // namespace gdata
160 160
161 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_UTIL_H_ 161 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_UTIL_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_uploader.cc ('k') | chrome/browser/chromeos/gdata/gdata_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698