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

Unified Diff: chrome/browser/sync_file_system/drive_file_sync_client.cc

Issue 11411280: Sync FileSystem: Use app id part of the URL for its directory title. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanup Created 8 years, 1 month 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/sync_file_system/drive_file_sync_client.cc
diff --git a/chrome/browser/sync_file_system/drive_file_sync_client.cc b/chrome/browser/sync_file_system/drive_file_sync_client.cc
index a192849b9078c6614b7c01ee72ed5e04a9d599a3..413203464fe98c491742509859c7ae5895ebf48d 100644
--- a/chrome/browser/sync_file_system/drive_file_sync_client.cc
+++ b/chrome/browser/sync_file_system/drive_file_sync_client.cc
@@ -12,6 +12,8 @@
#include "chrome/browser/google_apis/drive_uploader.h"
#include "chrome/browser/google_apis/gdata_wapi_service.h"
#include "chrome/browser/google_apis/gdata_wapi_url_generator.h"
+#include "chrome/common/extensions/extension.h"
+#include "extensions/common/constants.h"
#include "net/base/escape.h"
#include "net/base/mime_util.h"
@@ -113,7 +115,7 @@ void DriveFileSyncClient::GetDriveDirectoryForOrigin(
const ResourceIdCallback& callback) {
DCHECK(CalledOnValidThread());
- std::string directory_name(origin.spec());
+ std::string directory_name(OriginToDirectoryTitle(origin));
SearchFilesInDirectory(
sync_root_resource_id,
FormatTitleQuery(directory_name),
@@ -356,6 +358,17 @@ void DriveFileSyncClient::DeleteFile(
AsWeakPtr(), remote_file_md5, callback)));
}
+// static
+std::string DriveFileSyncClient::OriginToDirectoryTitle(const GURL& origin) {
+ DCHECK(origin.SchemeIs(extensions::kExtensionScheme));
+ return origin.host();
+}
+
+// static
+GURL DriveFileSyncClient::DirectoryTitleToOrigin(const std::string& title) {
+ return extensions::Extension::GetBaseURLFromExtensionId(title);
+}
+
void DriveFileSyncClient::DidGetDocumentFeedData(
const DocumentFeedCallback& callback,
google_apis::GDataErrorCode error,

Powered by Google App Engine
This is Rietveld 408576698