Index: chrome/browser/google_apis/gdata_wapi_url_util.cc |
diff --git a/chrome/browser/google_apis/gdata_wapi_url_util.cc b/chrome/browser/google_apis/gdata_wapi_url_util.cc |
index 21e8970ba9dbc60af437822d98e96ca5636fa7ea..a9a945b90f104a55141fbf45d8ee6876a2ee58e0 100644 |
--- a/chrome/browser/google_apis/gdata_wapi_url_util.cc |
+++ b/chrome/browser/google_apis/gdata_wapi_url_util.cc |
@@ -4,6 +4,7 @@ |
#include "chrome/browser/google_apis/gdata_wapi_url_util.h" |
+#include "base/logging.h" |
#include "base/stringprintf.h" |
#include "chrome/common/net/url_util.h" |
#include "googleurl/src/gurl.h" |
@@ -43,19 +44,6 @@ const char kGetDocumentListURLForSharedWithMe[] = |
const char kGetChangesListURL[] = |
"https://docs.google.com/feeds/default/private/changes"; |
-// Generates 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. |
-// This function is used to implement GenerateGetDocumentsURL(). |
-GURL GenerateDocumentListURL(const std::string& directory_resource_id) { |
- if (directory_resource_id.empty()) |
- return GURL(kGetDocumentListURLForAllDocuments); |
- |
- return GURL(base::StringPrintf(kGetDocumentListURLForDirectoryFormat, |
- net::EscapePath( |
- directory_resource_id).c_str())); |
-} |
- |
} // namespace |
GURL AddStandardUrlParams(const GURL& url) { |
@@ -103,7 +91,7 @@ GURL AddFeedUrlParams(const GURL& url, |
return result; |
} |
-GURL GenerateGetDocumentsURL( |
+GURL GenerateDocumentListUrl( |
const GURL& override_url, |
int start_changestamp, |
const std::string& search_string, |
@@ -111,34 +99,25 @@ GURL GenerateGetDocumentsURL( |
const std::string& directory_resource_id) { |
int max_docs = search_string.empty() ? kMaxDocumentsPerFeed : |
kMaxDocumentsPerSearchFeed; |
- |
- if (!override_url.is_empty()) |
- return gdata_wapi_url_util::AddFeedUrlParams(override_url, |
- max_docs, |
- 0, |
- search_string); |
- |
- if (shared_with_me) { |
- return gdata_wapi_url_util::AddFeedUrlParams( |
- GURL(kGetDocumentListURLForSharedWithMe), |
- max_docs, |
- 0, |
- search_string); |
+ GURL url; |
+ if (!override_url.is_empty()) { |
+ url = override_url; |
+ } else if (shared_with_me) { |
+ url = GURL(kGetDocumentListURLForSharedWithMe); |
+ } else if (start_changestamp > 0) { |
hashimoto
2012/11/20 06:16:06
Ah, sorry, '!= 0' and DCHECK_LE(0, start_changesta
satorux1
2012/11/20 06:27:33
Added a DCHECK at the beginning of the function.
|
+ // The start changestamp shouldn't be used for a search. |
+ DCHECK(search_string.empty()); |
+ url = GURL(kGetChangesListURL); |
+ } else if (!directory_resource_id.empty()) { |
+ DCHECK_EQ(0, start_changestamp); |
+ url = GURL(base::StringPrintf(kGetDocumentListURLForDirectoryFormat, |
+ net::EscapePath( |
+ directory_resource_id).c_str())); |
+ } else { |
+ DCHECK_EQ(0, start_changestamp); |
+ url = GURL(kGetDocumentListURLForAllDocuments); |
} |
- |
- if (start_changestamp == 0) { |
- return gdata_wapi_url_util::AddFeedUrlParams( |
- gdata_wapi_url_util::GenerateDocumentListURL(directory_resource_id), |
- max_docs, |
- 0, |
- search_string); |
- } |
- |
- return gdata_wapi_url_util::AddFeedUrlParams( |
- GURL(kGetChangesListURL), |
- kMaxDocumentsPerFeed, |
- start_changestamp, |
- std::string()); |
+ return AddFeedUrlParams(url, max_docs, start_changestamp, search_string); |
} |
} // namespace gdata_wapi_url_util |