| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "webkit/database/database_util.h" | 5 #include "webkit/database/database_util.h" |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" | 8 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" |
| 9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" | 9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" |
| 10 #include "webkit/database/database_tracker.h" | 10 #include "webkit/database/database_tracker.h" |
| 11 #include "webkit/database/vfs_backend.h" | 11 #include "webkit/database/vfs_backend.h" |
| 12 | 12 |
| 13 namespace webkit_database { | 13 namespace webkit_database { |
| 14 | 14 |
| 15 const char DatabaseUtil::kJournalFileSuffix[] = "-journal"; |
| 16 |
| 15 bool DatabaseUtil::CrackVfsFileName(const string16& vfs_file_name, | 17 bool DatabaseUtil::CrackVfsFileName(const string16& vfs_file_name, |
| 16 string16* origin_identifier, | 18 string16* origin_identifier, |
| 17 string16* database_name, | 19 string16* database_name, |
| 18 string16* sqlite_suffix) { | 20 string16* sqlite_suffix) { |
| 19 // 'vfs_file_name' is of the form <origin_identifier>/<db_name>#<suffix>. | 21 // 'vfs_file_name' is of the form <origin_identifier>/<db_name>#<suffix>. |
| 20 // <suffix> is optional. | 22 // <suffix> is optional. |
| 21 DCHECK(!vfs_file_name.empty()); | 23 DCHECK(!vfs_file_name.empty()); |
| 22 size_t first_slash_index = vfs_file_name.find('/'); | 24 size_t first_slash_index = vfs_file_name.find('/'); |
| 23 size_t last_pound_index = vfs_file_name.rfind('#'); | 25 size_t last_pound_index = vfs_file_name.rfind('#'); |
| 24 // '/' and '#' must be present in the string. Also, the string cannot start | 26 // '/' and '#' must be present in the string. Also, the string cannot start |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 } | 75 } |
| 74 | 76 |
| 75 GURL DatabaseUtil::GetOriginFromIdentifier(const string16& origin_identifier) { | 77 GURL DatabaseUtil::GetOriginFromIdentifier(const string16& origin_identifier) { |
| 76 GURL origin(WebKit::WebSecurityOrigin::createFromDatabaseIdentifier( | 78 GURL origin(WebKit::WebSecurityOrigin::createFromDatabaseIdentifier( |
| 77 origin_identifier).toString()); | 79 origin_identifier).toString()); |
| 78 DCHECK(origin == origin.GetOrigin()); | 80 DCHECK(origin == origin.GetOrigin()); |
| 79 return origin; | 81 return origin; |
| 80 } | 82 } |
| 81 | 83 |
| 82 } // namespace webkit_database | 84 } // namespace webkit_database |
| OLD | NEW |