| 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_WAPI_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_WAPI_SERVICE_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_WAPI_SERVICE_H_ | 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_WAPI_SERVICE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "chrome/browser/chromeos/gdata/drive_service_interface.h" | 13 #include "chrome/browser/chromeos/gdata/drive_service_interface.h" |
| 14 #include "chrome/browser/google_apis/auth_service.h" | 14 #include "chrome/browser/google_apis/auth_service.h" |
| 15 #include "chrome/browser/google_apis/gdata_operations.h" | 15 #include "chrome/browser/google_apis/gdata_operations.h" |
| 16 | 16 |
| 17 class FilePath; | 17 class FilePath; |
| 18 class GURL; | 18 class GURL; |
| 19 class Profile; | 19 class Profile; |
| 20 | 20 |
| 21 namespace gdata { | 21 namespace gdata { |
| 22 | 22 |
| 23 class OperationRunner; | 23 class OperationRunner; |
| 24 | 24 |
| 25 // This class provides documents feed service calls for WAPI (codename for | 25 // This class provides documents feed service calls for WAPI (codename for |
| 26 // DocumentsList API). | 26 // DocumentsList API). |
| 27 // Details of API call are abstracted in each operation class and this class | 27 // Details of API call are abstracted in each operation class and this class |
| 28 // works as a thin wrapper for the API. | 28 // works as a thin wrapper for the API. |
| 29 class GDataWapiService : public DriveServiceInterface, | 29 class GDataWapiService : public DriveServiceInterface, |
| 30 public AuthService::Observer { | 30 public AuthService::Observer, |
| 31 public OperationRegistry::Observer { |
| 31 public: | 32 public: |
| 32 // Instance is usually created by DriveSystemServiceFactory and owned by | 33 // Instance is usually created by DriveSystemServiceFactory and owned by |
| 33 // DriveFileSystem. | 34 // DriveFileSystem. |
| 34 GDataWapiService(); | 35 GDataWapiService(); |
| 35 virtual ~GDataWapiService(); | 36 virtual ~GDataWapiService(); |
| 36 | 37 |
| 37 AuthService* auth_service_for_testing(); | 38 AuthService* auth_service_for_testing(); |
| 38 | 39 |
| 39 // DriveServiceInterface Overrides | 40 // DriveServiceInterface Overrides |
| 40 virtual void Initialize(Profile* profile) OVERRIDE; | 41 virtual void Initialize(Profile* profile) OVERRIDE; |
| 41 virtual void AddObserver(DriveServiceObserver* observer) OVERRIDE; | 42 virtual void AddObserver(DriveServiceObserver* observer) OVERRIDE; |
| 42 virtual void RemoveObserver(DriveServiceObserver* observer) OVERRIDE; | 43 virtual void RemoveObserver(DriveServiceObserver* observer) OVERRIDE; |
| 43 virtual OperationRegistry* operation_registry() const OVERRIDE; | |
| 44 virtual bool CanStartOperation() const OVERRIDE; | 44 virtual bool CanStartOperation() const OVERRIDE; |
| 45 virtual void CancelAll() OVERRIDE; | 45 virtual void CancelAll() OVERRIDE; |
| 46 virtual bool CancelForFilePath(const FilePath& file_path) OVERRIDE; |
| 47 virtual OperationProgressStatusList GetProgressStatusList() const OVERRIDE; |
| 46 virtual void Authenticate(const AuthStatusCallback& callback) OVERRIDE; | 48 virtual void Authenticate(const AuthStatusCallback& callback) OVERRIDE; |
| 47 virtual bool HasAccessToken() const OVERRIDE; | 49 virtual bool HasAccessToken() const OVERRIDE; |
| 48 virtual bool HasRefreshToken() const OVERRIDE; | 50 virtual bool HasRefreshToken() const OVERRIDE; |
| 49 virtual void GetDocuments(const GURL& feed_url, | 51 virtual void GetDocuments(const GURL& feed_url, |
| 50 int64 start_changestamp, | 52 int64 start_changestamp, |
| 51 const std::string& search_query, | 53 const std::string& search_query, |
| 52 const std::string& directory_resource_id, | 54 const std::string& directory_resource_id, |
| 53 const GetDataCallback& callback) OVERRIDE; | 55 const GetDataCallback& callback) OVERRIDE; |
| 54 virtual void GetDocumentEntry(const std::string& resource_id, | 56 virtual void GetDocumentEntry(const std::string& resource_id, |
| 55 const GetDataCallback& callback) OVERRIDE; | 57 const GetDataCallback& callback) OVERRIDE; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 const GetDataCallback& callback) OVERRIDE; | 92 const GetDataCallback& callback) OVERRIDE; |
| 91 virtual void InitiateUpload(const InitiateUploadParams& params, | 93 virtual void InitiateUpload(const InitiateUploadParams& params, |
| 92 const InitiateUploadCallback& callback) OVERRIDE; | 94 const InitiateUploadCallback& callback) OVERRIDE; |
| 93 virtual void ResumeUpload(const ResumeUploadParams& params, | 95 virtual void ResumeUpload(const ResumeUploadParams& params, |
| 94 const ResumeUploadCallback& callback) OVERRIDE; | 96 const ResumeUploadCallback& callback) OVERRIDE; |
| 95 virtual void AuthorizeApp(const GURL& resource_url, | 97 virtual void AuthorizeApp(const GURL& resource_url, |
| 96 const std::string& app_id, | 98 const std::string& app_id, |
| 97 const GetDataCallback& callback) OVERRIDE; | 99 const GetDataCallback& callback) OVERRIDE; |
| 98 | 100 |
| 99 private: | 101 private: |
| 102 OperationRegistry* operation_registry() const; |
| 103 |
| 100 // AuthService::Observer override. | 104 // AuthService::Observer override. |
| 101 virtual void OnOAuth2RefreshTokenChanged() OVERRIDE; | 105 virtual void OnOAuth2RefreshTokenChanged() OVERRIDE; |
| 102 | 106 |
| 107 // DriveServiceObserver Overrides |
| 108 virtual void OnProgressUpdate( |
| 109 const OperationProgressStatusList& list) OVERRIDE; |
| 110 virtual void OnAuthenticationFailed() OVERRIDE; |
| 111 |
| 103 Profile* profile_; | 112 Profile* profile_; |
| 104 scoped_ptr<OperationRunner> runner_; | 113 scoped_ptr<OperationRunner> runner_; |
| 105 ObserverList<DriveServiceObserver> observers_; | 114 ObserverList<DriveServiceObserver> observers_; |
| 106 | 115 |
| 107 DISALLOW_COPY_AND_ASSIGN(GDataWapiService); | 116 DISALLOW_COPY_AND_ASSIGN(GDataWapiService); |
| 108 }; | 117 }; |
| 109 | 118 |
| 110 } // namespace gdata | 119 } // namespace gdata |
| 111 | 120 |
| 112 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_WAPI_SERVICE_H_ | 121 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_WAPI_SERVICE_H_ |
| OLD | NEW |