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

Unified Diff: storage/browser/database/database_util.cc

Issue 442383002: Move storage-related files from webkit/ to new top-level directory storage/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 4 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 | « storage/browser/database/database_util.h ('k') | storage/browser/database/databases_table.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: storage/browser/database/database_util.cc
diff --git a/webkit/browser/database/database_util.cc b/storage/browser/database/database_util.cc
similarity index 70%
rename from webkit/browser/database/database_util.cc
rename to storage/browser/database/database_util.cc
index 14a54551ae7af91d8eaed4b9abf78a702816ff67..9661ed00140cd1dcf020987a9c1931382ae8f089 100644
--- a/webkit/browser/database/database_util.cc
+++ b/storage/browser/database/database_util.cc
@@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "webkit/browser/database/database_util.h"
+#include "storage/browser/database/database_util.h"
#include "base/basictypes.h"
#include "base/strings/utf_string_conversions.h"
-#include "webkit/browser/database/database_tracker.h"
-#include "webkit/browser/database/vfs_backend.h"
-#include "webkit/common/database/database_identifier.h"
+#include "storage/browser/database/database_tracker.h"
+#include "storage/browser/database/vfs_backend.h"
+#include "storage/common/database/database_identifier.h"
namespace webkit_database {
@@ -16,11 +16,11 @@ namespace {
bool IsSafeSuffix(const base::string16& suffix) {
base::char16 prev_c = 0;
- for (base::string16::const_iterator it = suffix.begin();
- it < suffix.end(); ++it) {
+ for (base::string16::const_iterator it = suffix.begin(); it < suffix.end();
+ ++it) {
base::char16 c = *it;
- if (!(IsAsciiAlpha(c) || IsAsciiDigit(c) ||
- c == '-' || c == '.' || c == '_')) {
+ if (!(IsAsciiAlpha(c) || IsAsciiDigit(c) || c == '-' || c == '.' ||
+ c == '_')) {
return false;
}
if (c == '.' && prev_c == '.')
@@ -29,7 +29,6 @@ bool IsSafeSuffix(const base::string16& suffix) {
}
return true;
}
-
}
const char DatabaseUtil::kJournalFileSuffix[] = "-journal";
@@ -46,14 +45,13 @@ bool DatabaseUtil::CrackVfsFileName(const base::string16& vfs_file_name,
// '/' and '#' must be present in the string. Also, the string cannot start
// with a '/' (origin_identifier cannot be empty) and '/' must come before '#'
if ((first_slash_index == base::string16::npos) ||
- (last_pound_index == base::string16::npos) ||
- (first_slash_index == 0) ||
+ (last_pound_index == base::string16::npos) || (first_slash_index == 0) ||
(first_slash_index > last_pound_index)) {
return false;
}
- std::string origin_id = base::UTF16ToASCII(
- vfs_file_name.substr(0, first_slash_index));
+ std::string origin_id =
+ base::UTF16ToASCII(vfs_file_name.substr(0, first_slash_index));
if (!IsValidOriginIdentifier(origin_id))
return false;
@@ -77,25 +75,26 @@ bool DatabaseUtil::CrackVfsFileName(const base::string16& vfs_file_name,
}
base::FilePath DatabaseUtil::GetFullFilePathForVfsFile(
- DatabaseTracker* db_tracker, const base::string16& vfs_file_name) {
+ DatabaseTracker* db_tracker,
+ const base::string16& vfs_file_name) {
std::string origin_identifier;
base::string16 database_name;
base::string16 sqlite_suffix;
- if (!CrackVfsFileName(vfs_file_name, &origin_identifier,
- &database_name, &sqlite_suffix)) {
- return base::FilePath(); // invalid vfs_file_name
+ if (!CrackVfsFileName(
+ vfs_file_name, &origin_identifier, &database_name, &sqlite_suffix)) {
+ return base::FilePath(); // invalid vfs_file_name
}
- base::FilePath full_path = db_tracker->GetFullDBFilePath(
- origin_identifier, database_name);
+ base::FilePath full_path =
+ db_tracker->GetFullDBFilePath(origin_identifier, database_name);
if (!full_path.empty() && !sqlite_suffix.empty()) {
DCHECK(full_path.Extension().empty());
- full_path = full_path.InsertBeforeExtensionASCII(
- base::UTF16ToASCII(sqlite_suffix));
+ full_path =
+ full_path.InsertBeforeExtensionASCII(base::UTF16ToASCII(sqlite_suffix));
}
// Watch out for directory traversal attempts from a compromised renderer.
if (full_path.value().find(FILE_PATH_LITERAL("..")) !=
- base::FilePath::StringType::npos)
+ base::FilePath::StringType::npos)
return base::FilePath();
return full_path;
}
« no previous file with comments | « storage/browser/database/database_util.h ('k') | storage/browser/database/databases_table.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698