Index: chrome/browser/chromeos/gdata/gdata.h |
diff --git a/chrome/browser/chromeos/gdata/gdata.h b/chrome/browser/chromeos/gdata/gdata.h |
index 96fa5bac6dad3fb256de0d5767c50eb4f3f6ccd9..73d33d39d9fd441c9a95f7d1eae18b06a6085f96 100644 |
--- a/chrome/browser/chromeos/gdata/gdata.h |
+++ b/chrome/browser/chromeos/gdata/gdata.h |
@@ -183,47 +183,48 @@ class GDataAuthService : public content::NotificationObserver { |
DISALLOW_COPY_AND_ASSIGN(GDataAuthService); |
}; |
-// This class provides documents feed service calls. |
-class DocumentsService : public GDataAuthService::Observer { |
+// This defines an interface for sharing by DocumentService and |
+// MockDocumentService so that we can do testing of clients of DocumentService. |
+class DocumentsServiceInterface { |
public: |
- // DocumentsService is usually owned and created by GDataFileSystem. |
- DocumentsService(); |
- virtual ~DocumentsService(); |
+ DocumentsServiceInterface(); |
Ben Chan
2012/03/08 02:01:19
nit: per style guide, the empty default constructo
Greg Spencer (Chromium)
2012/03/08 19:06:35
Done.
|
+ virtual ~DocumentsServiceInterface(); |
satorux1
2012/03/08 01:48:37
you could inline {} for pure virtual interface cla
Greg Spencer (Chromium)
2012/03/08 19:06:35
Done.
|
// Initializes the documents service tied with |profile|. |
- void Initialize(Profile* profile); |
+ virtual void Initialize(Profile* profile) = 0; |
// Cancels all in-flight operations. |
- void CancelAll(); |
+ virtual void CancelAll() = 0; |
// Authenticates the user by fetching the auth token as |
// needed. |callback| will be run with the error code and the auth |
// token, on the thread this function is run. |
// |
// Must be called on UI thread. |
- void Authenticate(const AuthStatusCallback& callback); |
+ virtual void Authenticate(const AuthStatusCallback& callback) = 0; |
// Gets the document feed from |feed_url|. If this URL is empty, the call |
// will fetch the default ('root') document feed. Upon completion, |
// invokes |callback| with results on the calling thread. |
// |
// Can be called on any thread. |
- void GetDocuments(const GURL& feed_url, const GetDataCallback& callback); |
+ virtual void GetDocuments(const GURL& feed_url, |
+ const GetDataCallback& callback) = 0; |
// Delete a document identified by its 'self' |url| and |etag|. |
Ben Chan
2012/03/08 02:01:19
nit: for consistency, Delete -> Deletes
Greg Spencer (Chromium)
2012/03/08 19:06:35
Done.
|
// Upon completion, invokes |callback| with results on the calling thread. |
// |
// Can be called on any thread. |
- void DeleteDocument(const GURL& document_url, |
- const EntryActionCallback& callback); |
+ virtual void DeleteDocument(const GURL& document_url, |
+ const EntryActionCallback& callback) = 0; |
// Downloads a document identified by its |content_url| in a given |format|. |
// Upon completion, invokes |callback| with results on the calling thread. |
// |
// Can be called on any thread. |
- void DownloadDocument(const GURL& content_url, |
- DocumentExportFormat format, |
- const DownloadActionCallback& callback); |
+ virtual void DownloadDocument(const GURL& content_url, |
+ DocumentExportFormat format, |
+ const DownloadActionCallback& callback) = 0; |
// Creates new collection with |directory_name| under parent directory |
// identified with |parent_content_url|. If |parent_content_url| is empty, |
@@ -231,28 +232,59 @@ class DocumentsService : public GDataAuthService::Observer { |
// invokes |callback| and passes newly created entry on the calling thread. |
// |
// Can be called on any thread. |
- void CreateDirectory(const GURL& parent_content_url, |
- const FilePath::StringType& directory_name, |
- const GetDataCallback& callback); |
+ virtual void CreateDirectory(const GURL& parent_content_url, |
+ const FilePath::StringType& directory_name, |
+ const GetDataCallback& callback) = 0; |
// Downloads a file identified by its |content_url|. Upon completion, invokes |
// |callback| with results on the calling thread. |
// |
// Can be called on any thread. |
- void DownloadFile(const GURL& content_url, |
- const DownloadActionCallback& callback); |
+ virtual void DownloadFile(const GURL& content_url, |
+ const DownloadActionCallback& callback) = 0; |
// Initiate uploading of a document/file. |
Ben Chan
2012/03/08 02:01:19
nit: for consistency, Initiate -> Initiates
Greg Spencer (Chromium)
2012/03/08 19:06:35
Done.
|
// |
// Can be called on any thread. |
- void InitiateUpload(const InitiateUploadParams& params, |
- const InitiateUploadCallback& callback); |
+ virtual void InitiateUpload(const InitiateUploadParams& upload_file_info, |
satorux1
2012/03/08 01:48:37
upload_file_info -> params
Greg Spencer (Chromium)
2012/03/08 19:06:35
Done. Didn't mean to change this.
|
+ const InitiateUploadCallback& callback) = 0; |
// Resume uploading of a document/file on the calling thread. |
Ben Chan
2012/03/08 02:01:19
nit: for consistency, Resume -> Resumes
Greg Spencer (Chromium)
2012/03/08 19:06:35
Done.
|
// |
// Can be called on any thread. |
+ virtual void ResumeUpload(const ResumeUploadParams& upload_file_info, |
satorux1
2012/03/08 01:48:37
ditto. params
Greg Spencer (Chromium)
2012/03/08 19:06:35
Done.
|
+ const ResumeUploadCallback& callback) = 0; |
+}; |
+ |
+// This class provides documents feed service calls. |
+class DocumentsService |
+ : public DocumentsServiceInterface, |
+ public GDataAuthService::Observer { |
+ public: |
+ // DocumentsService is usually owned and created by GDataFileSystem. |
+ DocumentsService(); |
+ virtual ~DocumentsService(); |
+ |
+ // DocumentsServiceInterface Overrides |
+ void Initialize(Profile* profile) OVERRIDE; |
satorux1
2012/03/08 01:48:37
Please add 'virtual' to these.
Greg Spencer (Chromium)
2012/03/08 19:06:35
Done. Another casualty of that one bad merge.
|
+ void CancelAll() OVERRIDE; |
+ void Authenticate(const AuthStatusCallback& callback) OVERRIDE; |
+ void GetDocuments(const GURL& feed_url, |
+ const GetDataCallback& callback) OVERRIDE; |
+ void DeleteDocument(const GURL& document_url, |
+ const EntryActionCallback& callback) OVERRIDE; |
+ void DownloadDocument(const GURL& content_url, |
+ DocumentExportFormat format, |
+ const DownloadActionCallback& callback) OVERRIDE; |
+ void CreateDirectory(const GURL& parent_content_url, |
+ const FilePath::StringType& directory_name, |
+ const GetDataCallback& callback) OVERRIDE; |
+ void DownloadFile(const GURL& content_url, |
+ const DownloadActionCallback& callback) OVERRIDE; |
+ void InitiateUpload(const InitiateUploadParams& params, |
+ const InitiateUploadCallback& callback) OVERRIDE; |
void ResumeUpload(const ResumeUploadParams& params, |
- const ResumeUploadCallback& callback); |
+ const ResumeUploadCallback& callback) OVERRIDE; |
GDataAuthService* gdata_auth_service() { return gdata_auth_service_.get(); } |