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

Unified Diff: chrome/browser/google_apis/gdata_operations.h

Issue 11143014: Add request header on gdata operation for testing ETag match. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: build fix & test fix Created 8 years, 2 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_operations.h
diff --git a/chrome/browser/google_apis/gdata_operations.h b/chrome/browser/google_apis/gdata_operations.h
index 8912b97ef40d37aa7ceb5007323653175b2a0e20..3fa602cd9b7e7d0115039015098eb085e8f6e3bc 100644
--- a/chrome/browser/google_apis/gdata_operations.h
+++ b/chrome/browser/google_apis/gdata_operations.h
@@ -103,7 +103,8 @@ class DownloadFileOperation : public UrlFetchOperationBase {
const GetContentCallback& get_content_callback,
const GURL& document_url,
const FilePath& virtual_path,
- const FilePath& output_file_path);
+ const FilePath& output_file_path,
+ const std::string& etag);
virtual ~DownloadFileOperation();
protected:
@@ -111,6 +112,7 @@ class DownloadFileOperation : public UrlFetchOperationBase {
virtual GURL GetURL() const OVERRIDE;
virtual void ProcessURLFetchResults(const net::URLFetcher* source) OVERRIDE;
virtual void RunCallbackOnPrematureFailure(GDataErrorCode code) OVERRIDE;
+ virtual std::vector<std::string> GetExtraRequestHeaders() const OVERRIDE;
// Overridden from net::URLFetcherDelegate.
virtual void OnURLFetchDownloadProgress(const net::URLFetcher* source,
@@ -124,6 +126,7 @@ class DownloadFileOperation : public UrlFetchOperationBase {
DownloadActionCallback download_action_callback_;
GetContentCallback get_content_callback_;
GURL document_url_;
+ std::string etag_;
DISALLOW_COPY_AND_ASSIGN(DownloadFileOperation);
};
@@ -135,7 +138,8 @@ class DeleteDocumentOperation : public EntryActionOperation {
public:
DeleteDocumentOperation(OperationRegistry* registry,
const EntryActionCallback& callback,
- const GURL& document_url);
+ const GURL& document_url,
+ const std::string& etag);
virtual ~DeleteDocumentOperation();
protected:
@@ -147,6 +151,8 @@ class DeleteDocumentOperation : public EntryActionOperation {
virtual std::vector<std::string> GetExtraRequestHeaders() const OVERRIDE;
private:
+ std::string etag_;
+
DISALLOW_COPY_AND_ASSIGN(DeleteDocumentOperation);
};
@@ -327,9 +333,10 @@ class RemoveResourceFromDirectoryOperation : public EntryActionOperation {
// When uploading a new file (UPLOAD_NEW_FILE):
// - |title| should be set.
// - |upload_location| should be the upload_url() of the parent directory.
+// - |etag| should be empty.
//
// When updating an existing file (UPLOAD_EXISTING_FILE):
-// - |title| should be empty
+// - |title| should be empty.
// - |upload_location| should be the upload_url() of the existing file.
struct InitiateUploadParams {
InitiateUploadParams(UploadMode upload_mode,
@@ -337,7 +344,8 @@ struct InitiateUploadParams {
const std::string& content_type,
int64 content_length,
const GURL& upload_location,
- const FilePath& virtual_path);
+ const FilePath& virtual_path,
+ const std::string& etag);
~InitiateUploadParams();
UploadMode upload_mode;
@@ -345,7 +353,8 @@ struct InitiateUploadParams {
std::string content_type;
int64 content_length;
GURL upload_location;
- const FilePath& virtual_path;
+ FilePath virtual_path;
kochi 2012/10/16 05:04:58 Why unconst for virtual_path?
tzik 2012/10/16 05:48:05 Just to keep it consistent with other place in thi
kochi 2012/10/16 06:31:21 Okay, could you do this in a separate CL?
tzik 2012/10/16 06:46:18 OK, reverted.
+ const std::string etag;
tzik 2012/10/16 06:46:18 This const looks not consistent with others. I'll
};
// Callback type for DocumentServiceInterface::InitiateUpload.
@@ -419,6 +428,7 @@ struct ResumeUploadParams {
// Virtual GData path of the file seen in the UI. Not necessary for
// resuming an upload, but used for adding an entry to OperationRegistry.
FilePath virtual_path;
+ std::string etag;
};
// Callback type for DocumentServiceInterface::ResumeUpload.

Powered by Google App Engine
This is Rietveld 408576698