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

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

Issue 10834170: gdata: Move GDataWapiFeedLoader to a set of new files (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add missing files... 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 <vector> 9 #include <vector>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/tracked_objects.h"
achuithb 2012/08/04 08:12:25 I think you can probably fwd declare tracked_objec
satorux1 2012/08/04 08:16:34 Done.
12 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
13 #include "base/platform_file.h" 14 #include "base/platform_file.h"
14 #include "base/time.h" 15 #include "base/time.h"
15 #include "chrome/browser/chromeos/gdata/gdata_errorcode.h" 16 #include "chrome/browser/chromeos/gdata/gdata_errorcode.h"
16 #include "googleurl/src/gurl.h" 17 #include "googleurl/src/gurl.h"
17 18
18 class FilePath; 19 class FilePath;
19 class Profile; 20 class Profile;
20 21
22 namespace base {
23 class SequencedTaskRunner;
24 } // namespace base
25
21 namespace gdata { 26 namespace gdata {
22 namespace util { 27 namespace util {
23 28
24 // Path constants. 29 // Path constants.
25 30
26 // The extension for dirty files. The file names look like 31 // The extension for dirty files. The file names look like
27 // "<resource-id>.local". 32 // "<resource-id>.local".
28 const char kLocallyModifiedFileExtension[] = "local"; 33 const char kLocallyModifiedFileExtension[] = "local";
29 // The extension for mounted files. The file names look like 34 // The extension for mounted files. The file names look like
30 // "<resource-id>.<md5>.mounted". 35 // "<resource-id>.<md5>.mounted".
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 // Parses an RFC 3339 date/time into a base::Time, returning true on success. 110 // 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 111 // 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). 112 // either '+hh:mm', '-hh:mm', 'Z' (representing UTC), or an empty string).
108 bool GetTimeFromString(const base::StringPiece& raw_value, base::Time* time); 113 bool GetTimeFromString(const base::StringPiece& raw_value, base::Time* time);
109 114
110 // Formats a base::Time as an RFC 3339 date/time (in UTC). 115 // Formats a base::Time as an RFC 3339 date/time (in UTC).
111 std::string FormatTimeAsString(const base::Time& time); 116 std::string FormatTimeAsString(const base::Time& time);
112 117
113 // Callback type for PrepareWritableFilePathAndRun. 118 // Callback type for PrepareWritableFilePathAndRun.
114 typedef base::Callback<void (GDataFileError, const FilePath& path)> 119 typedef base::Callback<void (GDataFileError, const FilePath& path)>
115 OpenFileCallback; 120 OpenFileCallback;
116 121
117 // Invokes |callback| on blocking thread pool, after converting virtual |path| 122 // Invokes |callback| on blocking thread pool, after converting virtual |path|
118 // string like "/special/drive/foo.txt" to the concrete local cache file path. 123 // 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. 124 // After |callback| returns, the written content is synchronized to the server.
120 // 125 //
121 // If |path| is not a GData path, it is regarded as a local path and no path 126 // If |path| is not a GData path, it is regarded as a local path and no path
122 // conversion takes place. 127 // conversion takes place.
123 // 128 //
124 // Must be called from UI thread. 129 // Must be called from UI thread.
125 void PrepareWritableFileAndRun(Profile* profile, 130 void PrepareWritableFileAndRun(Profile* profile,
126 const FilePath& path, 131 const FilePath& path,
127 const OpenFileCallback& callback); 132 const OpenFileCallback& callback);
128 133
134 // Converts gdata error code into file platform error code.
135 GDataFileError GDataToGDataFileError(GDataErrorCode status);
136
137 // Wrapper around BrowserThread::PostTask to post a task to the blocking
138 // pool with the given sequence token.
139 void PostBlockingPoolSequencedTask(
140 const tracked_objects::Location& from_here,
141 base::SequencedTaskRunner* blocking_task_runner,
142 const base::Closure& task);
143
144 // Similar to PostBlockingPoolSequencedTask() but this one takes a reply
145 // callback that runs on the calling thread.
146 void PostBlockingPoolSequencedTaskAndReply(
147 const tracked_objects::Location& from_here,
148 base::SequencedTaskRunner* blocking_task_runner,
149 const base::Closure& request_task,
150 const base::Closure& reply_task);
151
129 } // namespace util 152 } // namespace util
130 } // namespace gdata 153 } // namespace gdata
131 154
132 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_UTIL_H_ 155 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698