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

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

Issue 12039005: drive: Deal with the root directory in the same way as others in MoveOperation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fix. Created 7 years, 11 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 09e7abbbc87db57005cedaf29500568ff3ee8a7a..2c865f777b125b474f165a3aaf7606239d949a12 100644
--- a/chrome/browser/google_apis/gdata_wapi_operations.cc
+++ b/chrome/browser/google_apis/gdata_wapi_operations.cc
@@ -489,10 +489,9 @@ AddResourceToDirectoryOperation::AddResourceToDirectoryOperation(
AddResourceToDirectoryOperation::~AddResourceToDirectoryOperation() {}
GURL AddResourceToDirectoryOperation::GetURL() const {
- if (!parent_content_url_.is_empty())
- return GDataWapiUrlGenerator::AddStandardUrlParams(parent_content_url_);
-
- return url_generator_.GenerateResourceListRootUrl();
+ GURL parent = parent_content_url_.is_empty() ?
+ url_generator_.GenerateRootContentUrl() : parent_content_url_;
+ return GDataWapiUrlGenerator::AddStandardUrlParams(parent);
}
URLFetcher::RequestType
@@ -523,10 +522,12 @@ bool AddResourceToDirectoryOperation::GetContentData(
RemoveResourceFromDirectoryOperation::RemoveResourceFromDirectoryOperation(
OperationRegistry* registry,
net::URLRequestContextGetter* url_request_context_getter,
+ const GDataWapiUrlGenerator& url_generator,
const EntryActionCallback& callback,
const GURL& parent_content_url,
const std::string& document_resource_id)
: EntryActionOperation(registry, url_request_context_getter, callback),
+ url_generator_(url_generator),
resource_id_(document_resource_id),
parent_content_url_(parent_content_url) {
DCHECK(!callback.is_null());
@@ -536,9 +537,12 @@ RemoveResourceFromDirectoryOperation::~RemoveResourceFromDirectoryOperation() {
}
GURL RemoveResourceFromDirectoryOperation::GetURL() const {
+ GURL parent = parent_content_url_.is_empty() ?
+ url_generator_.GenerateRootContentUrl() : parent_content_url_;
+
std::string escaped_resource_id = net::EscapePath(resource_id_);
GURL edit_url(base::StringPrintf("%s/%s",
- parent_content_url_.spec().c_str(),
+ parent.spec().c_str(),
escaped_resource_id.c_str()));
return GDataWapiUrlGenerator::AddStandardUrlParams(edit_url);
}
« 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