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_WAPI_SERVICE_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_WAPI_SERVICE_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/memory/weak_ptr.h" |
| 12 #include "chrome/browser/chromeos/gdata/documents_service_interface.h" |
| 13 #include "chrome/browser/chromeos/gdata/gdata_operations.h" |
| 14 #include "chrome/browser/chromeos/gdata/gdata_auth_service.h" |
| 15 #include "chrome/browser/chromeos/gdata/gdata_errorcode.h" |
| 16 |
| 17 class FilePath; |
| 18 class GURL; |
| 19 class Profile; |
| 20 |
| 21 namespace gdata { |
| 22 |
| 23 class GDataOperationRunner; |
| 24 |
| 25 // This class provides documents feed service calls for WAPI (codename for |
| 26 // DocumentsList API). |
| 27 // Details of API call are abstracted in each operation class and this class |
| 28 // works as a thin wrapper for the API. |
| 29 class GDataWapiService : public DocumentsServiceInterface { |
| 30 public: |
| 31 // Instance is usually created by GDataSystemServiceFactory and owned by |
| 32 // GDataFileSystem. |
| 33 GDataWapiService(); |
| 34 virtual ~GDataWapiService(); |
| 35 |
| 36 GDataAuthService* auth_service_for_testing(); |
| 37 |
| 38 // DocumentsServiceInterface Overrides |
| 39 virtual void Initialize(Profile* profile) OVERRIDE; |
| 40 virtual GDataOperationRegistry* operation_registry() const OVERRIDE; |
| 41 virtual void CancelAll() OVERRIDE; |
| 42 virtual void Authenticate(const AuthStatusCallback& callback) OVERRIDE; |
| 43 virtual bool HasAccessToken() const OVERRIDE; |
| 44 virtual bool HasRefreshToken() const OVERRIDE; |
| 45 virtual void GetDocuments(const GURL& feed_url, |
| 46 int64 start_changestamp, |
| 47 const std::string& search_query, |
| 48 const std::string& directory_resource_id, |
| 49 const GetDataCallback& callback) OVERRIDE; |
| 50 virtual void GetDocumentEntry(const std::string& resource_id, |
| 51 const GetDataCallback& callback) OVERRIDE; |
| 52 |
| 53 virtual void GetAccountMetadata(const GetDataCallback& callback) OVERRIDE; |
| 54 virtual void GetApplicationInfo(const GetDataCallback& callback) OVERRIDE; |
| 55 virtual void DeleteDocument(const GURL& document_url, |
| 56 const EntryActionCallback& callback) OVERRIDE; |
| 57 virtual void DownloadDocument( |
| 58 const FilePath& virtual_path, |
| 59 const FilePath& local_cache_path, |
| 60 const GURL& content_url, |
| 61 DocumentExportFormat format, |
| 62 const DownloadActionCallback& callback) OVERRIDE; |
| 63 virtual void DownloadFile( |
| 64 const FilePath& virtual_path, |
| 65 const FilePath& local_cache_path, |
| 66 const GURL& content_url, |
| 67 const DownloadActionCallback& download_action_callback, |
| 68 const GetContentCallback& get_content_callback) OVERRIDE; |
| 69 virtual void CopyDocument(const std::string& resource_id, |
| 70 const FilePath::StringType& new_name, |
| 71 const GetDataCallback& callback) OVERRIDE; |
| 72 virtual void RenameResource(const GURL& document_url, |
| 73 const FilePath::StringType& new_name, |
| 74 const EntryActionCallback& callback) OVERRIDE; |
| 75 virtual void AddResourceToDirectory( |
| 76 const GURL& parent_content_url, |
| 77 const GURL& resource_url, |
| 78 const EntryActionCallback& callback) OVERRIDE; |
| 79 virtual void RemoveResourceFromDirectory( |
| 80 const GURL& parent_content_url, |
| 81 const GURL& resource_url, |
| 82 const std::string& resource_id, |
| 83 const EntryActionCallback& callback) OVERRIDE; |
| 84 virtual void CreateDirectory(const GURL& parent_content_url, |
| 85 const FilePath::StringType& directory_name, |
| 86 const GetDataCallback& callback) OVERRIDE; |
| 87 virtual void InitiateUpload(const InitiateUploadParams& params, |
| 88 const InitiateUploadCallback& callback) OVERRIDE; |
| 89 virtual void ResumeUpload(const ResumeUploadParams& params, |
| 90 const ResumeUploadCallback& callback) OVERRIDE; |
| 91 virtual void AuthorizeApp(const GURL& resource_url, |
| 92 const std::string& app_id, |
| 93 const GetDataCallback& callback) OVERRIDE; |
| 94 |
| 95 private: |
| 96 Profile* profile_; |
| 97 |
| 98 scoped_ptr<GDataOperationRunner> runner_; |
| 99 |
| 100 DISALLOW_COPY_AND_ASSIGN(GDataWapiService); |
| 101 }; |
| 102 |
| 103 } // namespace gdata |
| 104 |
| 105 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_WAPI_SERVICE_H_ |
OLD | NEW |