summaryrefslogtreecommitdiffstats
path: root/google_apis/drive/drive_api_url_generator.cc
diff options
context:
space:
mode:
authorkinaba@chromium.org <kinaba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-17 18:33:29 +0000
committerkinaba@chromium.org <kinaba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-17 18:33:29 +0000
commit9d917939772e82b21797bc0af444b3e8a3b12d4b (patch)
tree2370cf396d56f25176917a543618f0063eb43866 /google_apis/drive/drive_api_url_generator.cc
parentc8868c8b778fb3700e2c05c4868492a6c30ff70d (diff)
downloadchromium_src-9d917939772e82b21797bc0af444b3e8a3b12d4b.zip
chromium_src-9d917939772e82b21797bc0af444b3e8a3b12d4b.tar.gz
chromium_src-9d917939772e82b21797bc0af444b3e8a3b12d4b.tar.bz2
drive: Support authorizing third-party Drive apps for opening files.
Along the way, replace the official key check in DriveAppRegistry::IsUninstallSupported by the new devoted function. (In fact, the macro is available only during google_apis/ hence the previous code was not working well...) BUG=332332 Review URL: https://codereview.chromium.org/140783006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@245565 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'google_apis/drive/drive_api_url_generator.cc')
-rw-r--r--google_apis/drive/drive_api_url_generator.cc17
1 files changed, 14 insertions, 3 deletions
diff --git a/google_apis/drive/drive_api_url_generator.cc b/google_apis/drive/drive_api_url_generator.cc
index 275a348..e8660cc 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);
}