Chromium Code Reviews| Index: chrome/browser/chromeos/gdata/gdata_documents_service.h |
| diff --git a/chrome/browser/chromeos/gdata/gdata_documents_service.h b/chrome/browser/chromeos/gdata/gdata_documents_service.h |
| index 356ace41f98f66e8bb737affb7966cd1612ea2b8..78ccc925b2f14d65b32346c5a97f2716c9f1b6f1 100644 |
| --- a/chrome/browser/chromeos/gdata/gdata_documents_service.h |
| +++ b/chrome/browser/chromeos/gdata/gdata_documents_service.h |
| @@ -7,11 +7,19 @@ |
| #include <string> |
| +#include "base/basictypes.h" |
| +#include "base/callback.h" |
| +#include "base/file_path.h" |
| #include "base/memory/scoped_ptr.h" |
| #include "base/memory/weak_ptr.h" |
| +#include "base/platform_file.h" |
| +#include "base/values.h" |
| #include "chrome/browser/chromeos/gdata/gdata_auth_service.h" |
| +#include "chrome/browser/chromeos/gdata/gdata_documents_service.h" |
|
achuithb
2012/08/07 23:14:21
Isn't this gdata_documents_service.h?
|
| #include "chrome/browser/chromeos/gdata/gdata_errorcode.h" |
| -#include "chrome/browser/chromeos/gdata/gdata_params.h" |
| +#include "chrome/browser/chromeos/gdata/gdata_upload_file_info.h" |
| +#include "googleurl/src/gurl.h" |
| +#include "net/base/io_buffer.h" |
| class FilePath; |
| class GURL; |
| @@ -19,9 +27,11 @@ class Profile; |
| namespace gdata { |
| +class GDataEntry; |
| class GDataOperationInterface; |
| class GDataOperationRegistry; |
| class GDataOperationRunner; |
| +struct ResumeUploadResponse; |
| // Document export format. |
| enum DocumentExportFormat { |
| @@ -45,6 +55,107 @@ enum DocumentExportFormat { |
| // is returned in TSV by default. |
| }; |
| +// Callback type for DocumentServiceInterface::GetDocuments. |
| +// Note: feed_data argument should be passed using base::Passed(&feed_data), not |
| +// feed_data.Pass(). |
| +typedef base::Callback<void(GDataErrorCode error, |
| + scoped_ptr<base::Value> feed_data)> GetDataCallback; |
| + |
| +// Callback type for Delete/Move DocumentServiceInterface calls. |
| +typedef base::Callback<void(GDataErrorCode error, |
| + const GURL& document_url)> EntryActionCallback; |
| + |
| +// Callback type for DownloadDocument/DownloadFile DocumentServiceInterface |
| +// calls. |
| +typedef base::Callback<void(GDataErrorCode error, |
| + const GURL& content_url, |
| + const FilePath& temp_file)> DownloadActionCallback; |
| + |
| +// Callback type for getting download data from DownloadFile |
| +// DocumentServiceInterface calls. |
| +typedef base::Callback<void( |
| + GDataErrorCode error, |
| + scoped_ptr<std::string> download_data)> GetDownloadDataCallback; |
| + |
| +// Callback type for DocumentServiceInterface::InitiateUpload. |
| +typedef base::Callback<void(GDataErrorCode error, |
| + const GURL& upload_url)> InitiateUploadCallback; |
| + |
| +// Callback type for DocumentServiceInterface::ResumeUpload. |
| +typedef base::Callback<void( |
| + const ResumeUploadResponse& response, |
| + scoped_ptr<gdata::DocumentEntry> new_entry)> ResumeUploadCallback; |
| + |
| +// Callback type used to get result of file search. |
| +// If |error| is not PLATFORM_FILE_OK, |entry| is set to NULL. |
| +typedef base::Callback<void(GDataFileError error, GDataEntry* entry)> |
| + FindEntryCallback; |
| + |
| +// Struct for response to ResumeUpload. |
| +struct ResumeUploadResponse { |
| + ResumeUploadResponse(GDataErrorCode code, |
| + int64 start_range_received, |
| + int64 end_range_received); |
| + ~ResumeUploadResponse(); |
| + |
| + GDataErrorCode code; |
| + int64 start_range_received; |
| + int64 end_range_received; |
| + FilePath virtual_path; |
| +}; |
| + |
| +// Struct for passing params needed for DocumentsService::ResumeUpload() calls. |
| +struct ResumeUploadParams { |
| + ResumeUploadParams(UploadMode upload_mode, |
| + int64 start_range, |
| + int64 end_range, |
| + int64 content_length, |
| + const std::string& content_type, |
| + scoped_refptr<net::IOBuffer> buf, |
| + const GURL& upload_location, |
| + const FilePath& virtual_path); |
| + ~ResumeUploadParams(); |
| + |
| + UploadMode upload_mode; // Mode of the upload. |
| + int64 start_range; // Start of range of contents currently stored in |buf|. |
| + int64 end_range; // End of range of contents currently stored in |buf|. |
| + int64 content_length; // File content-Length. |
| + std::string content_type; // Content-Type of file. |
| + scoped_refptr<net::IOBuffer> buf; // Holds current content to be uploaded. |
| + GURL upload_location; // Url of where to upload the file to. |
| + // Virtual GData path of the file seen in the UI. Not necessary for |
| + // resuming an upload, but used for adding an entry to |
| + // GDataOperationRegistry. |
| + FilePath virtual_path; |
| +}; |
| + |
| +// Struct for passing params needed for DocumentsService::InitiateUpload() |
| +// calls. |
| +// |
| +// When uploading a new file (UPLOAD_NEW_FILE): |
| +// - |title| should be set. |
| +// - |upload_location| should be the upload_url() of the parent directory. |
| +// |
| +// When updating an existing file (UPLOAD_EXISTING_FILE): |
| +// - |title| should be empty |
| +// - |upload_location| should be the upload_url() of the existing file. |
| +struct InitiateUploadParams { |
| + InitiateUploadParams(UploadMode upload_mode, |
| + const std::string& title, |
| + const std::string& content_type, |
| + int64 content_length, |
| + const GURL& upload_location, |
| + const FilePath& virtual_path); |
| + ~InitiateUploadParams(); |
| + |
| + UploadMode upload_mode; |
| + std::string title; |
| + std::string content_type; |
| + int64 content_length; |
| + GURL upload_location; |
| + const FilePath& virtual_path; |
| +}; |
| + |
| // This defines an interface for sharing by DocumentService and |
| // MockDocumentService so that we can do testing of clients of DocumentService. |
| // |