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

Side by Side Diff: chrome/browser/sync_file_system/drive_backend/metadata_db_migration_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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/sync_file_system/drive_backend/metadata_db_migration_ut il.h" 5 #include "chrome/browser/sync_file_system/drive_backend/metadata_db_migration_ut il.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "chrome/browser/sync_file_system/drive_backend/drive_backend_util.h" 10 #include "chrome/browser/sync_file_system/drive_backend/drive_backend_util.h"
11 #include "third_party/leveldatabase/src/include/leveldb/write_batch.h" 11 #include "third_party/leveldatabase/src/include/leveldb/write_batch.h"
12 #include "url/gurl.h" 12 #include "url/gurl.h"
13 #include "webkit/common/fileapi/file_system_types.h" 13 #include "storage/common/fileapi/file_system_types.h"
14 #include "webkit/common/fileapi/file_system_util.h" 14 #include "storage/common/fileapi/file_system_util.h"
15 15
16 namespace sync_file_system { 16 namespace sync_file_system {
17 namespace drive_backend { 17 namespace drive_backend {
18 18
19 namespace { 19 namespace {
20 20
21 const base::FilePath::CharType kV0FormatPathPrefix[] = 21 const base::FilePath::CharType kV0FormatPathPrefix[] =
22 FILE_PATH_LITERAL("drive/"); 22 FILE_PATH_LITERAL("drive/");
23 const char kWapiFileIdPrefix[] = "file:"; 23 const char kWapiFileIdPrefix[] = "file:";
24 const char kWapiFolderIdPrefix[] = "folder:"; 24 const char kWapiFolderIdPrefix[] = "folder:";
25 25
26 } // namespace 26 } // namespace
27 27
28 bool ParseV0FormatFileSystemURL(const GURL& url, 28 bool ParseV0FormatFileSystemURL(const GURL& url,
29 GURL* origin, 29 GURL* origin,
30 base::FilePath* path) { 30 base::FilePath* path) {
31 fileapi::FileSystemType mount_type; 31 storage::FileSystemType mount_type;
32 base::FilePath virtual_path; 32 base::FilePath virtual_path;
33 33
34 if (!fileapi::ParseFileSystemSchemeURL( 34 if (!storage::ParseFileSystemSchemeURL(
35 url, origin, &mount_type, &virtual_path) || 35 url, origin, &mount_type, &virtual_path) ||
36 mount_type != fileapi::kFileSystemTypeExternal) { 36 mount_type != storage::kFileSystemTypeExternal) {
37 NOTREACHED() << "Failed to parse filesystem scheme URL " << url.spec(); 37 NOTREACHED() << "Failed to parse filesystem scheme URL " << url.spec();
38 return false; 38 return false;
39 } 39 }
40 40
41 base::FilePath::StringType prefix = 41 base::FilePath::StringType prefix =
42 base::FilePath(kV0FormatPathPrefix).NormalizePathSeparators().value(); 42 base::FilePath(kV0FormatPathPrefix).NormalizePathSeparators().value();
43 if (virtual_path.value().substr(0, prefix.size()) != prefix) 43 if (virtual_path.value().substr(0, prefix.size()) != prefix)
44 return false; 44 return false;
45 45
46 *path = base::FilePath(virtual_path.value().substr(prefix.size())); 46 *path = base::FilePath(virtual_path.value().substr(prefix.size()));
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 295
296 DVLOG(3) << "Unknown key: " << key << " was found."; 296 DVLOG(3) << "Unknown key: " << key << " was found.";
297 } 297 }
298 298
299 return LevelDBStatusToSyncStatusCode( 299 return LevelDBStatusToSyncStatusCode(
300 db->Write(leveldb::WriteOptions(), &write_batch)); 300 db->Write(leveldb::WriteOptions(), &write_batch));
301 } 301 }
302 302
303 } // namespace drive_backend 303 } // namespace drive_backend
304 } // namespace sync_file_system 304 } // namespace sync_file_system
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698