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_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_H_ |
6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_H_ | 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
170 virtual void Observe(int type, | 170 virtual void Observe(int type, |
171 const content::NotificationSource& source, | 171 const content::NotificationSource& source, |
172 const content::NotificationDetails& details) OVERRIDE; | 172 const content::NotificationDetails& details) OVERRIDE; |
173 | 173 |
174 // Sets the auth_token as specified. This should be used only for testing. | 174 // Sets the auth_token as specified. This should be used only for testing. |
175 void set_oauth2_auth_token_for_testing(const std::string& token) { | 175 void set_oauth2_auth_token_for_testing(const std::string& token) { |
176 auth_token_ = token; | 176 auth_token_ = token; |
177 } | 177 } |
178 | 178 |
179 private: | 179 private: |
180 | |
181 // Helper function for StartAuthentication() call. | 180 // Helper function for StartAuthentication() call. |
182 void StartAuthenticationOnUIThread( | 181 void StartAuthenticationOnUIThread( |
183 GDataOperationRegistry* registry, | 182 GDataOperationRegistry* registry, |
184 scoped_refptr<base::MessageLoopProxy> relay_proxy, | 183 scoped_refptr<base::MessageLoopProxy> relay_proxy, |
185 const AuthStatusCallback& callback); | 184 const AuthStatusCallback& callback); |
186 | 185 |
187 | 186 |
188 Profile* profile_; | 187 Profile* profile_; |
189 std::string refresh_token_; | 188 std::string refresh_token_; |
190 std::string auth_token_; | 189 std::string auth_token_; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
232 const EntryActionCallback& callback) = 0; | 231 const EntryActionCallback& callback) = 0; |
233 | 232 |
234 // Downloads a document identified by its |content_url| in a given |format|. | 233 // Downloads a document identified by its |content_url| in a given |format|. |
235 // Upon completion, invokes |callback| with results on the calling thread. | 234 // Upon completion, invokes |callback| with results on the calling thread. |
236 // | 235 // |
237 // Can be called on any thread. | 236 // Can be called on any thread. |
238 virtual void DownloadDocument(const GURL& content_url, | 237 virtual void DownloadDocument(const GURL& content_url, |
239 DocumentExportFormat format, | 238 DocumentExportFormat format, |
240 const DownloadActionCallback& callback) = 0; | 239 const DownloadActionCallback& callback) = 0; |
241 | 240 |
241 // Makes a copy of a document identified by its 'self' link |document_url|. | |
242 // The copy is named as the UTF-8 encoded |new_name| and is not added to any | |
243 // collection. Use AddResourceToDirectory() to add the copy to a collection | |
244 // when needed. Upon completion, invokes |callback| with results. | |
satorux1
2012/03/12 17:48:24
nit: add "on the calling thread"
Ben Chan
2012/03/13 00:29:21
Done.
| |
245 // | |
246 // Can be called on any thread. | |
247 virtual void CopyDocument(const GURL& document_url, | |
248 const FilePath::StringType& new_name, | |
249 const GetDataCallback& callback) = 0; | |
250 | |
251 // Renames a document or collection identified by its 'self' link | |
252 // |document_url| to the UTF-8 encoded |new_name|. Upon completion, | |
253 // invokes |callback| with results. | |
satorux1
2012/03/12 17:48:24
ditto.
Ben Chan
2012/03/13 00:29:21
Done.
| |
254 // | |
255 // Can be called on any thread. | |
256 virtual void RenameResource(const GURL& resource_url, | |
257 const FilePath::StringType& new_name, | |
258 const EntryActionCallback& callback) = 0; | |
259 | |
260 // Adds a resource (document, file, or collection) identified by its | |
261 // 'self' link |resource_url| to a collection with a content link | |
satorux1
2012/03/12 17:48:24
nit: a collection -> a collection (directory)
I t
Ben Chan
2012/03/13 00:29:21
Yes, we should indeed make the terminology/naming
| |
262 // |parent_content_url|. Upon completion, invokes |callback| with | |
263 // results on the calling thread. | |
264 // | |
265 // Can be called on any thread. | |
266 virtual void AddResourceToDirectory(const GURL& parent_content_url, | |
267 const GURL& resource_url, | |
268 const EntryActionCallback& callback) = 0; | |
269 | |
270 // Removes a resource (document, file, collection) identified by its | |
271 // 'self' link |resource_url| from a collection with a content link | |
272 // |parent_content_url|. Upon completion, invokes |callback| with | |
273 // results on the calling thread. | |
274 // | |
275 // Can be called on any thread. | |
276 virtual void RemoveResourceFromDirectory( | |
277 const GURL& parent_content_url, | |
278 const GURL& resource_url, | |
279 const std::string& resource_id, | |
280 const EntryActionCallback& callback) = 0; | |
281 | |
242 // Creates new collection with |directory_name| under parent directory | 282 // Creates new collection with |directory_name| under parent directory |
243 // identified with |parent_content_url|. If |parent_content_url| is empty, | 283 // identified with |parent_content_url|. If |parent_content_url| is empty, |
244 // the new collection will be created in the root. Upon completion, | 284 // the new collection will be created in the root. Upon completion, |
245 // invokes |callback| and passes newly created entry on the calling thread. | 285 // invokes |callback| and passes newly created entry on the calling thread. |
246 // | 286 // |
247 // Can be called on any thread. | 287 // Can be called on any thread. |
248 virtual void CreateDirectory(const GURL& parent_content_url, | 288 virtual void CreateDirectory(const GURL& parent_content_url, |
249 const FilePath::StringType& directory_name, | 289 const FilePath::StringType& directory_name, |
250 const GetDataCallback& callback) = 0; | 290 const GetDataCallback& callback) = 0; |
251 | 291 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
283 virtual void CancelAll() OVERRIDE; | 323 virtual void CancelAll() OVERRIDE; |
284 virtual void Authenticate(const AuthStatusCallback& callback) OVERRIDE; | 324 virtual void Authenticate(const AuthStatusCallback& callback) OVERRIDE; |
285 virtual void GetDocuments(const GURL& feed_url, | 325 virtual void GetDocuments(const GURL& feed_url, |
286 const GetDataCallback& callback) OVERRIDE; | 326 const GetDataCallback& callback) OVERRIDE; |
287 virtual void DeleteDocument(const GURL& document_url, | 327 virtual void DeleteDocument(const GURL& document_url, |
288 const EntryActionCallback& callback) OVERRIDE; | 328 const EntryActionCallback& callback) OVERRIDE; |
289 virtual void DownloadDocument( | 329 virtual void DownloadDocument( |
290 const GURL& content_url, | 330 const GURL& content_url, |
291 DocumentExportFormat format, | 331 DocumentExportFormat format, |
292 const DownloadActionCallback& callback) OVERRIDE; | 332 const DownloadActionCallback& callback) OVERRIDE; |
333 virtual void CopyDocument(const GURL& document_url, | |
334 const FilePath::StringType& new_name, | |
335 const GetDataCallback& callback) OVERRIDE; | |
336 virtual void RenameResource(const GURL& document_url, | |
337 const FilePath::StringType& new_name, | |
338 const EntryActionCallback& callback) OVERRIDE; | |
339 virtual void AddResourceToDirectory( | |
340 const GURL& parent_content_url, | |
341 const GURL& resource_url, | |
342 const EntryActionCallback& callback) OVERRIDE; | |
343 virtual void RemoveResourceFromDirectory( | |
344 const GURL& parent_content_url, | |
345 const GURL& resource_url, | |
346 const std::string& resource_id, | |
347 const EntryActionCallback& callback) OVERRIDE; | |
293 virtual void CreateDirectory(const GURL& parent_content_url, | 348 virtual void CreateDirectory(const GURL& parent_content_url, |
294 const FilePath::StringType& directory_name, | 349 const FilePath::StringType& directory_name, |
295 const GetDataCallback& callback) OVERRIDE; | 350 const GetDataCallback& callback) OVERRIDE; |
296 virtual void DownloadFile(const GURL& content_url, | 351 virtual void DownloadFile(const GURL& content_url, |
297 const DownloadActionCallback& callback) OVERRIDE; | 352 const DownloadActionCallback& callback) OVERRIDE; |
298 virtual void InitiateUpload(const InitiateUploadParams& params, | 353 virtual void InitiateUpload(const InitiateUploadParams& params, |
299 const InitiateUploadCallback& callback) OVERRIDE; | 354 const InitiateUploadCallback& callback) OVERRIDE; |
300 virtual void ResumeUpload(const ResumeUploadParams& params, | 355 virtual void ResumeUpload(const ResumeUploadParams& params, |
301 const ResumeUploadCallback& callback) OVERRIDE; | 356 const ResumeUploadCallback& callback) OVERRIDE; |
302 | 357 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
338 scoped_ptr<GDataOperationRegistry> operation_registry_; | 393 scoped_ptr<GDataOperationRegistry> operation_registry_; |
339 base::WeakPtrFactory<DocumentsService> weak_ptr_factory_; | 394 base::WeakPtrFactory<DocumentsService> weak_ptr_factory_; |
340 base::WeakPtr<DocumentsService> weak_ptr_bound_to_ui_thread_; | 395 base::WeakPtr<DocumentsService> weak_ptr_bound_to_ui_thread_; |
341 | 396 |
342 DISALLOW_COPY_AND_ASSIGN(DocumentsService); | 397 DISALLOW_COPY_AND_ASSIGN(DocumentsService); |
343 }; | 398 }; |
344 | 399 |
345 } // namespace gdata | 400 } // namespace gdata |
346 | 401 |
347 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_H_ | 402 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_H_ |
OLD | NEW |