Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(912)

Unified Diff: chrome/browser/google_apis/gdata_wapi_operations.cc

Issue 12088104: Move DownloadFileOperation to base_operations. (Closed) Base URL: http://git.chromium.org/chromium/src.git@b148627_download_file_3_test_util
Patch Set: Rebase Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/google_apis/gdata_wapi_operations.cc
diff --git a/chrome/browser/google_apis/gdata_wapi_operations.cc b/chrome/browser/google_apis/gdata_wapi_operations.cc
index d3ddc261a7807252e58857c44ee1466a9a5f9e54..8ba5b21b381bf5b23501bd8d44d482a7df2438de 100644
--- a/chrome/browser/google_apis/gdata_wapi_operations.cc
+++ b/chrome/browser/google_apis/gdata_wapi_operations.cc
@@ -172,76 +172,6 @@ GURL GetAccountMetadataOperation::GetURL() const {
return url_generator_.GenerateAccountMetadataUrl();
}
-//============================ DownloadFileOperation ===========================
-
-DownloadFileOperation::DownloadFileOperation(
- OperationRegistry* registry,
- net::URLRequestContextGetter* url_request_context_getter,
- const DownloadActionCallback& download_action_callback,
- const GetContentCallback& get_content_callback,
- const GURL& content_url,
- const FilePath& drive_file_path,
- const FilePath& output_file_path)
- : UrlFetchOperationBase(registry,
- url_request_context_getter,
- OPERATION_DOWNLOAD,
- drive_file_path),
- download_action_callback_(download_action_callback),
- get_content_callback_(get_content_callback),
- content_url_(content_url) {
- DCHECK(!download_action_callback_.is_null());
- // get_content_callback may be null.
-
- // Make sure we download the content into a temp file.
- if (output_file_path.empty())
- set_save_temp_file(true);
- else
- set_output_file_path(output_file_path);
-}
-
-DownloadFileOperation::~DownloadFileOperation() {}
-
-// Overridden from UrlFetchOperationBase.
-GURL DownloadFileOperation::GetURL() const {
- return content_url_;
-}
-
-void DownloadFileOperation::OnURLFetchDownloadProgress(const URLFetcher* source,
- int64 current,
- int64 total) {
- NotifyProgress(current, total);
-}
-
-bool DownloadFileOperation::ShouldSendDownloadData() {
- return !get_content_callback_.is_null();
-}
-
-void DownloadFileOperation::OnURLFetchDownloadData(
- const URLFetcher* source,
- scoped_ptr<std::string> download_data) {
- if (!get_content_callback_.is_null())
- get_content_callback_.Run(HTTP_SUCCESS, download_data.Pass());
-}
-
-void DownloadFileOperation::ProcessURLFetchResults(const URLFetcher* source) {
- GDataErrorCode code = GetErrorCode(source);
-
- // Take over the ownership of the the downloaded temp file.
- FilePath temp_file;
- if (code == HTTP_SUCCESS &&
- !source->GetResponseAsFilePath(true, // take_ownership
- &temp_file)) {
- code = GDATA_FILE_ERROR;
- }
-
- download_action_callback_.Run(code, temp_file);
- OnProcessURLFetchResultsComplete(code == HTTP_SUCCESS);
-}
-
-void DownloadFileOperation::RunCallbackOnPrematureFailure(GDataErrorCode code) {
- download_action_callback_.Run(code, FilePath());
-}
-
//=========================== DeleteResourceOperation ==========================
DeleteResourceOperation::DeleteResourceOperation(
« no previous file with comments | « chrome/browser/google_apis/gdata_wapi_operations.h ('k') | chrome/browser/google_apis/gdata_wapi_operations_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698