OLD | NEW |
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/metadata_db_migration_util.h" | 5 #include "chrome/browser/sync_file_system/drive/metadata_db_migration_util.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/string_util.h" | 9 #include "base/string_util.h" |
10 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 | 32 |
33 bool ParseV0FormatFileSystemURL(const GURL& url, | 33 bool ParseV0FormatFileSystemURL(const GURL& url, |
34 GURL* origin, | 34 GURL* origin, |
35 base::FilePath* path) { | 35 base::FilePath* path) { |
36 fileapi::FileSystemType mount_type; | 36 fileapi::FileSystemType mount_type; |
37 base::FilePath virtual_path; | 37 base::FilePath virtual_path; |
38 | 38 |
39 if (!fileapi::FileSystemURL::ParseFileSystemSchemeURL( | 39 if (!fileapi::FileSystemURL::ParseFileSystemSchemeURL( |
40 url, origin, &mount_type, &virtual_path) || | 40 url, origin, &mount_type, &virtual_path) || |
41 mount_type != fileapi::kFileSystemTypeExternal) { | 41 mount_type != fileapi::kFileSystemTypeExternal) { |
42 NOTREACHED() << "Failed to parse filesystem scheme URL"; | 42 NOTREACHED() << "Failed to parse filesystem scheme URL " << url.spec(); |
43 return false; | 43 return false; |
44 } | 44 } |
45 | 45 |
46 base::FilePath::StringType prefix = | 46 base::FilePath::StringType prefix = |
47 base::FilePath(kV0FormatPathPrefix).NormalizePathSeparators().value(); | 47 base::FilePath(kV0FormatPathPrefix).NormalizePathSeparators().value(); |
48 if (virtual_path.value().substr(0, prefix.size()) != prefix) | 48 if (virtual_path.value().substr(0, prefix.size()) != prefix) |
49 return false; | 49 return false; |
50 | 50 |
51 *path = base::FilePath(virtual_path.value().substr(prefix.size())); | 51 *path = base::FilePath(virtual_path.value().substr(prefix.size())); |
52 return true; | 52 return true; |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 continue; | 242 continue; |
243 } | 243 } |
244 } | 244 } |
245 | 245 |
246 return LevelDBStatusToSyncStatusCode( | 246 return LevelDBStatusToSyncStatusCode( |
247 db->Write(leveldb::WriteOptions(), &write_batch)); | 247 db->Write(leveldb::WriteOptions(), &write_batch)); |
248 } | 248 } |
249 | 249 |
250 } // namespace drive | 250 } // namespace drive |
251 } // namespace sync_file_system | 251 } // namespace sync_file_system |
OLD | NEW |