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

Unified Diff: chrome/browser/google_apis/drive_api_service.cc

Issue 14013005: Move EscapeQueryStringValue to drive_api_util. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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/google_apis/drive_api_service.cc
diff --git a/chrome/browser/google_apis/drive_api_service.cc b/chrome/browser/google_apis/drive_api_service.cc
index 20b48049e8a71ce79ea910f82aeb02506beeaca9..6112532ae904292bc85956c675a4d4c9c1f6c2fe 100644
--- a/chrome/browser/google_apis/drive_api_service.cc
+++ b/chrome/browser/google_apis/drive_api_service.cc
@@ -17,6 +17,7 @@
#include "chrome/browser/google_apis/auth_service.h"
#include "chrome/browser/google_apis/drive_api_operations.h"
#include "chrome/browser/google_apis/drive_api_parser.h"
+#include "chrome/browser/google_apis/drive_api_util.h"
#include "chrome/browser/google_apis/gdata_wapi_operations.h"
#include "chrome/browser/google_apis/gdata_wapi_parser.h"
#include "chrome/browser/google_apis/operation_runner.h"
@@ -201,14 +202,6 @@ void ParseResourceEntryForUploadRangeAndRun(
callback.Run(response, entry.Pass());
}
-// It is necessary to escape ' to \' in the query's string value.
-// See also: https://developers.google.com/drive/search-parameters
-std::string EscapeQueryStringValue(const std::string& str) {
- std::string result;
- ReplaceChars(str, "'", "\\'", &result);
- return result;
-}
-
// The resource ID for the root directory for Drive API is defined in the spec:
// https://developers.google.com/drive/folder
const char kDriveApiRootDirectoryResourceId[] = "root";
@@ -327,7 +320,8 @@ void DriveAPIService::GetResourceListInDirectory(
url_generator_,
base::StringPrintf(
"'%s' in parents and trashed = false",
- EscapeQueryStringValue(directory_resource_id).c_str()),
+ drive::util::EscapeQueryStringValue(
+ directory_resource_id).c_str()),
base::Bind(&ParseResourceListOnBlockingPoolAndRun, callback)));
}
@@ -363,7 +357,8 @@ void DriveAPIService::SearchInDirectory(
base::StringPrintf(
"%s and '%s' in parents and trashed = false",
search_query.c_str(),
- EscapeQueryStringValue(directory_resource_id).c_str()),
+ drive::util::EscapeQueryStringValue(
+ directory_resource_id).c_str()),
base::Bind(&ParseResourceListOnBlockingPoolAndRun, callback)));
}
« no previous file with comments | « no previous file | chrome/browser/google_apis/drive_api_util.h » ('j') | chrome/browser/google_apis/drive_api_util.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698