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

Side by Side Diff: chrome/browser/sync_file_system/drive/metadata_db_migration_util.h

Issue 15951007: SyncFS: Factor out DriveMetadataDB migration functions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix win test Created 7 years, 6 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
« no previous file with comments | « no previous file | chrome/browser/sync_file_system/drive/metadata_db_migration_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_METADATA_DB_MIGRATION_UTIL_H_ 5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_METADATA_DB_MIGRATION_UTIL_H_
6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_METADATA_DB_MIGRATION_UTIL_H_ 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_METADATA_DB_MIGRATION_UTIL_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "chrome/browser/sync_file_system/sync_file_system.pb.h" 10 #include "chrome/browser/sync_file_system/sync_file_system.pb.h"
11 #include "third_party/leveldatabase/src/include/leveldb/db.h" 11 #include "third_party/leveldatabase/src/include/leveldb/db.h"
12 #include "webkit/browser/fileapi/syncable/sync_status_code.h" 12 #include "webkit/browser/fileapi/syncable/sync_status_code.h"
13 13
14 class GURL;
15
14 namespace sync_file_system { 16 namespace sync_file_system {
15 namespace drive { 17 namespace drive {
16 18
19 // Parses a filesystem URL which contains 'drive' as a service name
20 // (a.k.a. V0-format filesystem URL).
21 //
22 // When you parse V0-format filesystem URL, you should use this function instead
23 // of DeserializeSyncableFileSystemURL() since 'drive' service name is no longer
24 // used and the deserializer cannot parse the unregistered service name.
25 //
26 // EXAMPLE:
27 // Assume following argument is given.
28 // url: 'filesystem:http://www.example.com/external/drive/foo/bar'
29 // returns
30 // origin: 'http://www.example.com/'
31 // path: 'foo/bar'
32 bool ParseV0FormatFileSystemURL(const GURL& url,
33 GURL* origin,
34 base::FilePath* path);
35
17 // Adds "file:" prefix to WAPI resource ID. 36 // Adds "file:" prefix to WAPI resource ID.
18 // EXAMPLE: "xxx" => "file:xxx" 37 // EXAMPLE: "xxx" => "file:xxx"
19 std::string AddWapiFilePrefix(const std::string& resource_id); 38 std::string AddWapiFilePrefix(const std::string& resource_id);
20 39
21 // Adds "folder:" prefix to WAPI resource ID. 40 // Adds "folder:" prefix to WAPI resource ID.
22 // EXAMPLE: "xxx" => "folder:xxx" 41 // EXAMPLE: "xxx" => "folder:xxx"
23 std::string AddWapiFolderPrefix(const std::string& resource_id); 42 std::string AddWapiFolderPrefix(const std::string& resource_id);
24 43
25 // Adds a prefix corresponding to the given |type|. 44 // Adds a prefix corresponding to the given |type|.
26 std::string AddWapiIdPrefix(const std::string& resource_id, 45 std::string AddWapiIdPrefix(const std::string& resource_id,
27 DriveMetadata_ResourceType type); 46 DriveMetadata_ResourceType type);
28 47
29 // Removes a prefix from WAPI resource ID. 48 // Removes a prefix from WAPI resource ID.
30 // EXAMPLE: 49 // EXAMPLE:
31 // "file:xxx" => "xxx" 50 // "file:xxx" => "xxx"
32 // "folder:yyy" => "yyy" 51 // "folder:yyy" => "yyy"
33 // "zzz" => "zzz" 52 // "zzz" => "zzz"
34 std::string RemoveWapiIdPrefix(const std::string& resource_id); 53 std::string RemoveWapiIdPrefix(const std::string& resource_id);
35 54
36 // Migrate |db| scheme from version 1 to version 2. 55 // Migrate |db| schema from version 0 to version 1.
56 SyncStatusCode MigrateDatabaseFromV0ToV1(leveldb::DB* db);
57
58 // Migrate |db| schema from version 1 to version 2.
37 SyncStatusCode MigrateDatabaseFromV1ToV2(leveldb::DB* db); 59 SyncStatusCode MigrateDatabaseFromV1ToV2(leveldb::DB* db);
38 60
39 } // namespace drive 61 } // namespace drive
40 } // namespace sync_file_system 62 } // namespace sync_file_system
41 63
42 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_METADATA_DB_MIGRATION_UTIL_H_ 64 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_METADATA_DB_MIGRATION_UTIL_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/sync_file_system/drive/metadata_db_migration_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698