Index: chrome/browser/chromeos/gdata/gdata_operations.cc |
diff --git a/chrome/browser/chromeos/gdata/gdata_operations.cc b/chrome/browser/chromeos/gdata/gdata_operations.cc |
index 2217dd75b306f5f739dc905a542be2528d26b940..437f74a89694e39d21f1af60d187195dc41a0948 100644 |
--- a/chrome/browser/chromeos/gdata/gdata_operations.cc |
+++ b/chrome/browser/chromeos/gdata/gdata_operations.cc |
@@ -41,9 +41,13 @@ const char kIfMatchAllHeader[] = "If-Match: *"; |
const char kIfMatchHeaderFormat[] = "If-Match: %s"; |
// URL requesting documents list that belong to the authenticated user only |
-// (handled with '-/mine' part). |
-const char kGetDocumentListURL[] = |
+// (handled with '/mine' part). |
+const char kGetDocumentListURLForAllDocuments[] = |
"https://docs.google.com/feeds/default/private/full/-/mine"; |
+// URL requesting documents list in a particular directory specified by "%s" |
+// that belong to the authenticated user only (handled with '/mine' part). |
+const char kGetDocumentListURLForDirectoryFormat[] = |
+ "https://docs.google.com/feeds/default/private/full/%s/contents/mine"; |
// URL requesting documents list of changes to documents collections. |
const char kGetChangesListURL[] = |
@@ -137,6 +141,18 @@ GURL AddFeedUrlParams(const GURL& url, |
return result; |
} |
+// Formats a URL for getting document list. If |directory_resource_id| is |
+// empty, returns a URL for fetching all documents. If it's given, returns a |
+// URL for fetching documents in a particular directory. |
+GURL FormatDocumentListURL(const std::string& directory_resource_id) { |
+ if (resource_id.empty()) |
tbarzic
2012/05/18 19:59:03
s/resource_is/directory_resource_id/
but, you've
|
+ return GURL(kGetDocumentListURLForAllDocuments); |
+ |
+ return GURL(base::StringPrintf(kGetDocumentListURLForDirectoryFormat, |
+ net::EscapePath( |
+ directory_resource_id).c_str())); |
+} |
+ |
} // namespace |
namespace gdata { |
@@ -466,14 +482,18 @@ base::Value* GetDataOperation::ParseResponse(const std::string& data) { |
//============================ GetDocumentsOperation =========================== |
-GetDocumentsOperation::GetDocumentsOperation(GDataOperationRegistry* registry, |
- Profile* profile, |
- int start_changestamp, |
- const std::string& search_string, |
- const GetDataCallback& callback) |
+GetDocumentsOperation::GetDocumentsOperation( |
+ GDataOperationRegistry* registry, |
+ Profile* profile, |
+ int start_changestamp, |
+ const std::string& search_string, |
+ const std::string& directory_resource_id, |
+ |
+ const GetDataCallback& callback) |
: GetDataOperation(registry, profile, callback), |
start_changestamp_(start_changestamp), |
- search_string_(search_string) { |
+ search_string_(search_string), |
+ directory_resource_id_(directory_resource_id) { |
} |
GetDocumentsOperation::~GetDocumentsOperation() {} |
@@ -490,7 +510,7 @@ GURL GetDocumentsOperation::GetURL() const { |
std::string()); |
if (start_changestamp_ == 0) { |
- return AddFeedUrlParams(GURL(kGetDocumentListURL), |
+ return AddFeedUrlParams(FormatDocumentListURL(directory_resource_id_), |
kMaxDocumentsPerFeed, |
0, |
search_string_); |