diff options
author | achuith@chromium.org <achuith@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-14 22:12:31 +0000 |
---|---|---|
committer | achuith@chromium.org <achuith@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-14 22:12:31 +0000 |
commit | 1640c1f7f9bf18593a3c9006a2f4eb86928c5f82 (patch) | |
tree | f9cd79b53c89ca6036ed92cbff0faf78a06b1dca | |
parent | 17416753d55caac36361bd6cd53569590231aa87 (diff) | |
download | chromium_src-1640c1f7f9bf18593a3c9006a2f4eb86928c5f82.zip chromium_src-1640c1f7f9bf18593a3c9006a2f4eb86928c5f82.tar.gz chromium_src-1640c1f7f9bf18593a3c9006a2f4eb86928c5f82.tar.bz2 |
Move params/callbacks to gdata_params.
Reduce the size of gdata.h and remove gdata.h from gdata_files.h and gdata_file_system.h
BUG=NONE
TEST=NONE
Review URL: https://chromiumcodereview.appspot.com/9700014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@126766 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/chromeos/gdata/gdata.cc | 36 | ||||
-rw-r--r-- | chrome/browser/chromeos/gdata/gdata.h | 61 | ||||
-rw-r--r-- | chrome/browser/chromeos/gdata/gdata_file_system.h | 5 | ||||
-rw-r--r-- | chrome/browser/chromeos/gdata/gdata_files.h | 2 | ||||
-rw-r--r-- | chrome/browser/chromeos/gdata/gdata_params.cc | 35 | ||||
-rw-r--r-- | chrome/browser/chromeos/gdata/gdata_params.h | 73 |
6 files changed, 111 insertions, 101 deletions
diff --git a/chrome/browser/chromeos/gdata/gdata.cc b/chrome/browser/chromeos/gdata/gdata.cc index e322769..1f82df4 100644 --- a/chrome/browser/chromeos/gdata/gdata.cc +++ b/chrome/browser/chromeos/gdata/gdata.cc @@ -175,42 +175,6 @@ GURL AddFeedUrlParams(const GURL& url) { } // namespace -//============================== InitiateUploadParams ========================== - -InitiateUploadParams::InitiateUploadParams( - const std::string& title, - const std::string& content_type, - int64 content_length, - const GURL& resumable_create_media_link) - : title(title), - content_type(content_type), - content_length(content_length), - resumable_create_media_link(resumable_create_media_link) { -} - -InitiateUploadParams::~InitiateUploadParams() { -} - -//================================ ResumeUploadParams=========================== - -ResumeUploadParams::ResumeUploadParams(const std::string& title, - int64 start_range, - int64 end_range, - int64 content_length, - const std::string& content_type, - scoped_refptr<net::IOBuffer> buf, - const GURL& upload_location) : title(title), - start_range(start_range), - end_range(end_range), - content_length(content_length), - content_type(content_type), - buf(buf), - upload_location(upload_location) { -} - -ResumeUploadParams::~ResumeUploadParams() { -} - //================================ AuthOperation =============================== // OAuth2 authorization token retrieval operation. diff --git a/chrome/browser/chromeos/gdata/gdata.h b/chrome/browser/chromeos/gdata/gdata.h index 25c5e69..8d478b7 100644 --- a/chrome/browser/chromeos/gdata/gdata.h +++ b/chrome/browser/chromeos/gdata/gdata.h @@ -9,18 +9,13 @@ #include <string> #include <vector> -#include "base/callback.h" -#include "base/memory/weak_ptr.h" #include "base/observer_list.h" -#include "base/values.h" #include "chrome/browser/chromeos/gdata/gdata_errorcode.h" #include "chrome/browser/chromeos/gdata/gdata_params.h" #include "chrome/common/net/gaia/oauth2_access_token_fetcher.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" #include "content/public/common/url_fetcher.h" -#include "googleurl/src/gurl.h" -#include "net/base/io_buffer.h" class Profile; @@ -55,62 +50,6 @@ enum DocumentExportFormat { // is returned in TSV by default. }; -// Different callback types for various functionalities in DocumentsService. -typedef base::Callback<void(GDataErrorCode error, - const std::string& token)> AuthStatusCallback; - -// 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; - -typedef base::Callback<void(GDataErrorCode error, - const GURL& document_url)> EntryActionCallback; -typedef base::Callback<void(GDataErrorCode error, - const GURL& content_url, - const FilePath& temp_file)> DownloadActionCallback; -typedef base::Callback<void(GDataErrorCode error, - const GURL& upload_url)> - InitiateUploadCallback; -typedef base::Callback<void(const ResumeUploadResponse& response)> - ResumeUploadCallback; - -// Struct for passing params needed for DocumentsService::ResumeUpload() calls. -struct ResumeUploadParams { - ResumeUploadParams(const std::string& title, - int64 start_range, - int64 end_range, - int64 content_length, - const std::string& content_type, - scoped_refptr<net::IOBuffer> buf, - const GURL& upload_location); - ~ResumeUploadParams(); - - std::string title; // Title to be used for file to be uploaded. - 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. -}; - - -// Struct for passing params needed for DocumentsService::InitiateUpload() -// calls. -struct InitiateUploadParams { - InitiateUploadParams(const std::string& title, - const std::string& content_type, - int64 content_length, - const GURL& resumable_create_media_link); - ~InitiateUploadParams(); - - std::string title; - std::string content_type; - int64 content_length; - GURL resumable_create_media_link; -}; - // This class provides authentication for GData based services. // It integrates specific service integration with OAuth2 stack // (TokenService) and provides OAuth2 token refresh infrastructure. diff --git a/chrome/browser/chromeos/gdata/gdata_file_system.h b/chrome/browser/chromeos/gdata/gdata_file_system.h index 0981454..c539f58 100644 --- a/chrome/browser/chromeos/gdata/gdata_file_system.h +++ b/chrome/browser/chromeos/gdata/gdata_file_system.h @@ -15,9 +15,9 @@ #include "base/memory/scoped_ptr.h" #include "base/memory/singleton.h" #include "base/memory/weak_ptr.h" +#include "base/message_loop.h" #include "base/platform_file.h" #include "base/synchronization/lock.h" -#include "chrome/browser/chromeos/gdata/gdata.h" #include "chrome/browser/chromeos/gdata/gdata_files.h" #include "chrome/browser/chromeos/gdata/gdata_params.h" #include "chrome/browser/chromeos/gdata/gdata_parser.h" @@ -28,8 +28,7 @@ namespace gdata { -class DocumentsService; - +class DocumentsServiceInterface; class GDataDownloadObserver; // Delegate class used to deal with results of virtual directory request diff --git a/chrome/browser/chromeos/gdata/gdata_files.h b/chrome/browser/chromeos/gdata/gdata_files.h index c2feb5a..758a5df 100644 --- a/chrome/browser/chromeos/gdata/gdata_files.h +++ b/chrome/browser/chromeos/gdata/gdata_files.h @@ -16,7 +16,7 @@ #include "base/memory/weak_ptr.h" #include "base/platform_file.h" #include "base/synchronization/lock.h" -#include "chrome/browser/chromeos/gdata/gdata.h" +#include "chrome/browser/chromeos/gdata/gdata_params.h" #include "chrome/browser/chromeos/gdata/gdata_parser.h" #include "chrome/browser/chromeos/gdata/gdata_uploader.h" #include "chrome/browser/profiles/profile_keyed_service.h" diff --git a/chrome/browser/chromeos/gdata/gdata_params.cc b/chrome/browser/chromeos/gdata/gdata_params.cc index bfb540f..1fbbe30b 100644 --- a/chrome/browser/chromeos/gdata/gdata_params.cc +++ b/chrome/browser/chromeos/gdata/gdata_params.cc @@ -18,4 +18,39 @@ ResumeUploadResponse::ResumeUploadResponse(GDataErrorCode code, md5_checksum(md5_checksum) { } +ResumeUploadResponse::~ResumeUploadResponse() { +} + +InitiateUploadParams::InitiateUploadParams( + const std::string& title, + const std::string& content_type, + int64 content_length, + const GURL& resumable_create_media_link) + : title(title), + content_type(content_type), + content_length(content_length), + resumable_create_media_link(resumable_create_media_link) { +} + +InitiateUploadParams::~InitiateUploadParams() { +} + +ResumeUploadParams::ResumeUploadParams(const std::string& title, + int64 start_range, + int64 end_range, + int64 content_length, + const std::string& content_type, + scoped_refptr<net::IOBuffer> buf, + const GURL& upload_location) : title(title), + start_range(start_range), + end_range(end_range), + content_length(content_length), + content_type(content_type), + buf(buf), + upload_location(upload_location) { +} + +ResumeUploadParams::~ResumeUploadParams() { +} + } // namespace gdata diff --git a/chrome/browser/chromeos/gdata/gdata_params.h b/chrome/browser/chromeos/gdata/gdata_params.h index 325bbc7..1d9682a 100644 --- a/chrome/browser/chromeos/gdata/gdata_params.h +++ b/chrome/browser/chromeos/gdata/gdata_params.h @@ -11,6 +11,12 @@ #include <string> #include "base/basictypes.h" +#include "base/callback.h" +#include "base/file_path.h" +#include "base/memory/weak_ptr.h" +#include "base/values.h" +#include "net/base/io_buffer.h" +#include "googleurl/src/gurl.h" namespace gdata { @@ -22,6 +28,8 @@ struct ResumeUploadResponse { const std::string& resource_id, const std::string& md5_checksum); + ~ResumeUploadResponse(); + GDataErrorCode code; int64 start_range_received; int64 end_range_received; @@ -29,6 +37,71 @@ struct ResumeUploadResponse { std::string md5_checksum; }; +// Struct for passing params needed for DocumentsService::ResumeUpload() calls. +struct ResumeUploadParams { + ResumeUploadParams(const std::string& title, + int64 start_range, + int64 end_range, + int64 content_length, + const std::string& content_type, + scoped_refptr<net::IOBuffer> buf, + const GURL& upload_location); + ~ResumeUploadParams(); + + std::string title; // Title to be used for file to be uploaded. + 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. +}; + +// Struct for passing params needed for DocumentsService::InitiateUpload() +// calls. +struct InitiateUploadParams { + InitiateUploadParams(const std::string& title, + const std::string& content_type, + int64 content_length, + const GURL& resumable_create_media_link); + ~InitiateUploadParams(); + + std::string title; + std::string content_type; + int64 content_length; + GURL resumable_create_media_link; +}; + +// Different callback types for various functionalities in DocumentsService. + +// Callback type for authentication related DocumentService calls. +typedef base::Callback<void(GDataErrorCode error, + const std::string& token)> AuthStatusCallback; + +// 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 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)> ResumeUploadCallback; + } // namespace gdata #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_PARAMS_H_ |