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

Unified Diff: chrome/browser/chromeos/gdata/drive_api_operations.cc

Issue 10830300: Add GetFilelist/GetFile operations for Drive V2 API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix for comments. Created 8 years, 4 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/chromeos/gdata/drive_api_operations.cc
diff --git a/chrome/browser/chromeos/gdata/drive_api_operations.cc b/chrome/browser/chromeos/gdata/drive_api_operations.cc
index 778d3b7fbe5f00bdf7d9b59e11161e0123901127..bcdf628f695357b1cebfaea71dd67ea09cd75890 100644
--- a/chrome/browser/chromeos/gdata/drive_api_operations.cc
+++ b/chrome/browser/chromeos/gdata/drive_api_operations.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/chromeos/gdata/drive_api_operations.h"
#include "base/string_number_conversions.h"
+#include "base/stringprintf.h"
#include "chrome/common/net/url_util.h"
namespace {
@@ -14,6 +15,10 @@ const char kDriveV2ApplistURL[] = "https://www.googleapis.com/drive/v2/apps";
const char kDriveV2ChangelistURL[] =
"https://www.googleapis.com/drive/v2/changes";
+const char kDriveV2FilelistURL[] = "https://www.googleapis.com/drive/v2/files";
+const char kDriveV2FileURLFormat[] =
+ "https://www.googleapis.com/drive/v2/files/%s";
+
} // namespace
// TODO(kochi): Rename to namespace drive. http://crbug.com/136371
@@ -66,4 +71,43 @@ GURL GetChangelistOperation::GetURL() const {
return url_;
}
+//============================= GetFlielistOperation ===========================
+
+GetFilelistOperation::GetFilelistOperation(
+ GDataOperationRegistry* registry,
+ const GURL& url,
+ const std::string& search_string,
+ const GetDataCallback& callback)
+ : GetDataOperation(registry, callback),
+ url_(kDriveV2FilelistURL),
+ search_string_(search_string) {
+ if (!url.is_empty())
+ url_ = url;
+}
+
+GetFilelistOperation::~GetFilelistOperation() {}
+
+GURL GetFilelistOperation::GetURL() const {
+ if (!search_string_.empty()) {
+ return chrome_common_net::AppendOrReplaceQueryParameter(
+ url_, "q", search_string_);
+ }
+ return url_;
+}
+
+//=============================== GetFlieOperation =============================
+
+GetFileOperation::GetFileOperation(
+ GDataOperationRegistry* registry,
+ const std::string& file_id,
+ const GetDataCallback& callback)
+ : GetDataOperation(registry, callback),
+ file_id_(file_id) {}
+
+GetFileOperation::~GetFileOperation() {}
+
+GURL GetFileOperation::GetURL() const {
+ return GURL(base::StringPrintf(kDriveV2FileURLFormat, file_id_.c_str()));
+}
+
} // namespace gdata
« no previous file with comments | « chrome/browser/chromeos/gdata/drive_api_operations.h ('k') | chrome/browser/chromeos/gdata/gdata_documents_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698