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

Unified Diff: google_apis/drive/drive_api_url_generator.cc

Issue 140783006: drive: Support authorizing third-party Drive apps for opening files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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
« no previous file with comments | « google_apis/drive/drive_api_url_generator.h ('k') | google_apis/drive/drive_api_url_generator_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: google_apis/drive/drive_api_url_generator.cc
diff --git a/google_apis/drive/drive_api_url_generator.cc b/google_apis/drive/drive_api_url_generator.cc
index e9d89d25d55a7851d2092674c4d36bc632807a40..203400d549b558a0e60b2b53ebc9bdab1b45f849 100644
--- a/google_apis/drive/drive_api_url_generator.cc
+++ b/google_apis/drive/drive_api_url_generator.cc
@@ -17,9 +17,6 @@ namespace {
// Hard coded URLs for communication with a google drive server.
const char kDriveV2AboutUrl[] = "/drive/v2/about";
const char kDriveV2AppsUrl[] = "/drive/v2/apps";
-// apps.delete API is exposed through a special endpoint v2internal that
-// is accessible only by the official API key for Chrome.
-const char kDriveV2AppsDeleteUrlFormat[] = "/drive/v2internal/apps/%s";
const char kDriveV2ChangelistUrl[] = "/drive/v2/changes";
const char kDriveV2FilesUrl[] = "/drive/v2/files";
const char kDriveV2FileUrlPrefix[] = "/drive/v2/files/";
@@ -33,6 +30,12 @@ const char kDriveV2InitiateUploadNewFileUrl[] = "/upload/drive/v2/files";
const char kDriveV2InitiateUploadExistingFileUrlPrefix[] =
"/upload/drive/v2/files/";
+// apps.delete and file.authorize API is exposed through a special endpoint
+// v2internal that is accessible only by the official API key for Chrome.
+const char kDriveV2AppsDeleteUrlFormat[] = "/drive/v2internal/apps/%s";
+const char kDriveV2FilesAuthorizeUrlFormat[] =
+ "/drive/v2internal/files/%s/authorize?appId=%s";
+
GURL AddResumableUploadParam(const GURL& url) {
return net::AppendOrReplaceQueryParameter(url, "uploadType", "resumable");
}
@@ -72,6 +75,14 @@ GURL DriveApiUrlGenerator::GetFilesGetUrl(const std::string& file_id) const {
return base_url_.Resolve(kDriveV2FileUrlPrefix + net::EscapePath(file_id));
}
+GURL DriveApiUrlGenerator::GetFilesAuthorizeUrl(
+ const std::string& file_id,
+ const std::string& app_id) const {
+ return base_url_.Resolve(base::StringPrintf(kDriveV2FilesAuthorizeUrlFormat,
+ net::EscapePath(file_id).c_str(),
+ net::EscapePath(app_id).c_str()));
+}
+
GURL DriveApiUrlGenerator::GetFilesInsertUrl() const {
return base_url_.Resolve(kDriveV2FilesUrl);
}
« no previous file with comments | « google_apis/drive/drive_api_url_generator.h ('k') | google_apis/drive/drive_api_url_generator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698