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

Unified Diff: chrome/browser/chromeos/drive/file_system_util.cc

Issue 296593003: Make various string_util functions take StringPieces instead of char[]. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Resync Created 6 years, 7 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 | « chrome/browser/autocomplete/builtin_provider.cc ('k') | chrome/browser/drive/drive_api_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/drive/file_system_util.cc
diff --git a/chrome/browser/chromeos/drive/file_system_util.cc b/chrome/browser/chromeos/drive/file_system_util.cc
index 5cba03ba7c2dfce64029474087a2b2f2f624ab91..1abe96fc528474146bfde253fc343e9b780e9457 100644
--- a/chrome/browser/chromeos/drive/file_system_util.cc
+++ b/chrome/browser/chromeos/drive/file_system_util.cc
@@ -48,21 +48,6 @@ namespace util {
namespace {
-const base::FilePath::CharType kSpecialMountPointRoot[] =
- FILE_PATH_LITERAL("/special");
-
-const char kDriveMountPointNameBase[] = "drive";
-
-const base::FilePath::CharType kDriveMyDriveRootPath[] =
- FILE_PATH_LITERAL("drive/root");
-
-const base::FilePath::CharType kFileCacheVersionDir[] =
- FILE_PATH_LITERAL("v1");
-
-const char kSlash[] = "/";
-const char kDot = '.';
-const char kEscapedChars[] = "_";
-
std::string ReadStringFromGDocFile(const base::FilePath& file_path,
const std::string& key) {
const int64 kMaxGDocSize = 4096;
@@ -123,12 +108,15 @@ const base::FilePath& GetDriveGrandRootPath() {
const base::FilePath& GetDriveMyDriveRootPath() {
CR_DEFINE_STATIC_LOCAL(base::FilePath, drive_root_path,
- (kDriveMyDriveRootPath));
+ (FILE_PATH_LITERAL("drive/root")));
return drive_root_path;
}
base::FilePath GetDriveMountPointPathForUserIdHash(
const std::string user_id_hash) {
+ static const base::FilePath::CharType kSpecialMountPointRoot[] =
+ FILE_PATH_LITERAL("/special");
+ static const char kDriveMountPointNameBase[] = "drive";
return base::FilePath(kSpecialMountPointRoot).AppendASCII(
net::EscapePath(kDriveMountPointNameBase +
(user_id_hash.empty() ? "" : "-" + user_id_hash)));
@@ -267,6 +255,8 @@ base::FilePath GetCacheRootPath(Profile* profile) {
chrome::GetUserCacheDirectory(profile->GetPath(), &cache_base_path);
base::FilePath cache_root_path =
cache_base_path.Append(chromeos::kDriveCacheDirname);
+ static const base::FilePath::CharType kFileCacheVersionDir[] =
+ FILE_PATH_LITERAL("v1");
return cache_root_path.Append(kFileCacheVersionDir);
}
@@ -304,9 +294,9 @@ std::string NormalizeFileName(const std::string& input) {
std::string output;
if (!base::ConvertToUtf8AndNormalize(input, base::kCodepageUTF8, &output))
output = input;
- base::ReplaceChars(output, kSlash, std::string(kEscapedChars), &output);
- if (!output.empty() && output.find_first_not_of(kDot, 0) == std::string::npos)
- output = kEscapedChars;
+ base::ReplaceChars(output, "/", "_", &output);
+ if (!output.empty() && output.find_first_not_of('.', 0) == std::string::npos)
+ output = "_";
return output;
}
« no previous file with comments | « chrome/browser/autocomplete/builtin_provider.cc ('k') | chrome/browser/drive/drive_api_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698