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

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

Issue 10693109: Use Drive v2 API: enable behind --enable-drive-api flag (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 5 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/gdata_operations.cc
diff --git a/chrome/browser/chromeos/gdata/gdata_operations.cc b/chrome/browser/chromeos/gdata/gdata_operations.cc
index 5c4adf5f14bd81b9536f884963b4d5a02853fd40..3487ab9655e407dcf0e1903a75e1c924c6e3993d 100644
--- a/chrome/browser/chromeos/gdata/gdata_operations.cc
+++ b/chrome/browser/chromeos/gdata/gdata_operations.cc
@@ -10,7 +10,6 @@
#include "base/string_number_conversions.h"
#include "base/values.h"
#include "chrome/browser/browser_process.h"
-#include "chrome/browser/chromeos/gdata/gdata_file_system.h"
#include "chrome/browser/chromeos/gdata/gdata_util.h"
#include "chrome/common/net/gaia/gaia_urls.h"
#include "chrome/common/net/gaia/google_service_auth_error.h"
@@ -68,6 +67,9 @@ const char kGetDocumentEntryURLFormat[] =
const char kAccountMetadataURL[] =
"https://docs.google.com/feeds/metadata/default";
+const char kDriveV2AboutURL[] =
+ "https://www.googleapis.com/drive/v2/about";
+
const char kUploadContentRange[] = "Content-Range: bytes ";
const char kUploadContentType[] = "X-Upload-Content-Type: ";
const char kUploadContentLength[] = "X-Upload-Content-Length: ";
@@ -97,6 +99,13 @@ const char kDocsListScope[] = "https://docs.google.com/feeds/";
const char kSpreadsheetsScope[] = "https://spreadsheets.google.com/feeds/";
const char kUserContentScope[] = "https://docs.googleusercontent.com/";
+// OAuth scope for Google Drive v2 API
+// See https://developers.google.com/drive/scopes.
+// Tokens with scope https://docs.google.com/feeds are accepted and treated
+// the same as tokens with scope https://www.googleapis.com/auth/drive and
+// this is not necessary for the migration period.
+const char kDriveScope[] = "https://www.googleapis.com/auth/drive";
+
// Adds additional parameters for API version, output content type and to show
// folders in the feed are added to document feed URLs.
GURL AddStandardUrlParams(const GURL& url) {
@@ -567,14 +576,17 @@ GURL GetDocumentEntryOperation::GetURL() const {
GetAccountMetadataOperation::GetAccountMetadataOperation(
GDataOperationRegistry* registry,
Profile* profile,
- const GetDataCallback& callback)
- : GetDataOperation(registry, profile, callback) {
+ const GetDataCallback& callback,
+ bool use_drive_api)
+ : GetDataOperation(registry, profile, callback),
+ use_drive_api_(use_drive_api) {
}
GetAccountMetadataOperation::~GetAccountMetadataOperation() {}
GURL GetAccountMetadataOperation::GetURL() const {
- return AddMetadataUrlParams(GURL(kAccountMetadataURL));
+ return use_drive_api_ ?
+ GURL(kDriveV2AboutURL) : AddMetadataUrlParams(GURL(kAccountMetadataURL));
}
//============================ DownloadFileOperation ===========================

Powered by Google App Engine
This is Rietveld 408576698