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

Side by Side Diff: webkit/fileapi/syncable/syncable_file_system_util.h

Issue 15806012: Move webkit/fileapi/syncable/* code to webkit/browser/fileapi (final!) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef WEBKIT_FILEAPI_SYNCABLE_SYNCABLE_FILE_SYSTEM_UTIL_H_
6 #define WEBKIT_FILEAPI_SYNCABLE_SYNCABLE_FILE_SYSTEM_UTIL_H_
7
8 #include <string>
9
10 #include "base/files/file_path.h"
11 #include "webkit/browser/fileapi/file_system_url.h"
12 #include "webkit/storage/webkit_storage_export.h"
13
14 namespace fileapi {
15 class FileSystemContext;
16 class FileSystemURL;
17 class LocalFileSystemOperation;
18 }
19
20 namespace sync_file_system {
21
22 // Registers a syncable filesystem with the given |service_name|.
23 WEBKIT_STORAGE_EXPORT bool RegisterSyncableFileSystem(
24 const std::string& service_name);
25
26 // Revokes the syncable filesystem that was registered with |service_name|.
27 WEBKIT_STORAGE_EXPORT bool RevokeSyncableFileSystem(
28 const std::string& service_name);
29
30 // Returns the root URI of the syncable filesystem that can be specified by a
31 // pair of |origin| and |service_name|.
32 WEBKIT_STORAGE_EXPORT GURL GetSyncableFileSystemRootURI(
33 const GURL& origin, const std::string& service_name);
34
35 // Creates a FileSystem URL for the |path| in a syncable filesystem
36 // identifiable by a pair of |origin| and |service_name|.
37 //
38 // Example: Assume following arguments are given:
39 // origin: 'http://www.example.com/',
40 // service_name: 'service_name',
41 // path: '/foo/bar',
42 // returns 'filesystem:http://www.example.com/external/service_name/foo/bar'
43 WEBKIT_STORAGE_EXPORT fileapi::FileSystemURL CreateSyncableFileSystemURL(
44 const GURL& origin, const std::string& service_name,
45 const base::FilePath& path);
46
47 // Serializes a given FileSystemURL |url| and sets the serialized string to
48 // |serialized_url|. If the URL does not represent a syncable filesystem,
49 // |serialized_url| is not filled in, and returns false. Separators of the
50 // path will be normalized depending on its platform.
51 //
52 // Example: Assume a following FileSystemURL object is given:
53 // origin() returns 'http://www.example.com/',
54 // type() returns the kFileSystemTypeSyncable,
55 // filesystem_id() returns 'service_name',
56 // path() returns '/foo/bar',
57 // this URL will be serialized to
58 // (on Windows)
59 // 'filesystem:http://www.example.com/external/service_name/foo\\bar'
60 // (on others)
61 // 'filesystem:http://www.example.com/external/service_name/foo/bar'
62 WEBKIT_STORAGE_EXPORT bool SerializeSyncableFileSystemURL(
63 const fileapi::FileSystemURL& url, std::string* serialized_url);
64
65 // Deserializes a serialized FileSystem URL string |serialized_url| and sets the
66 // deserialized value to |url|. If the reconstructed object is invalid or does
67 // not represent a syncable filesystem, returns false.
68 //
69 // NOTE: On any platform other than Windows, this function assumes that
70 // |serialized_url| does not contain '\\'. If it contains '\\' on such
71 // platforms, '\\' may be replaced with '/' (It would not be an expected
72 // behavior).
73 //
74 // See the comment of SerializeSyncableFileSystemURL() for more details.
75 WEBKIT_STORAGE_EXPORT bool DeserializeSyncableFileSystemURL(
76 const std::string& serialized_url, fileapi::FileSystemURL* url);
77
78 // Returns a new FileSystemOperation that can be used to apply changes
79 // for sync. The operation returned by this method:
80 // * does NOT notify the file change tracker, but
81 // * notifies the regular sandboxed quota observer
82 // therefore quota will be updated appropriately without bothering the
83 // change tracker.
84 WEBKIT_STORAGE_EXPORT fileapi::LocalFileSystemOperation*
85 CreateFileSystemOperationForSync(
86 fileapi::FileSystemContext* file_system_context);
87
88 // Enables or disables directory operations in Sync FileSystem API.
89 // TODO(nhiroki): This method should be used only for testing and should go
90 // away when we fully support directory operations. (http://crbug.com/161442)
91 WEBKIT_STORAGE_EXPORT void SetEnableSyncFSDirectoryOperation(bool flag);
92
93 // Returns true if we allow directory operations in Sync FileSystem API.
94 // It is disabled by default but can be overridden by a command-line switch
95 // (--enable-syncfs-directory-operations) or by calling
96 // SetEnableSyncFSDirectoryOperation().
97 // TODO(nhiroki): This method should be used only for testing and should go
98 // away when we fully support directory operations. (http://crbug.com/161442)
99 WEBKIT_STORAGE_EXPORT bool IsSyncFSDirectoryOperationEnabled();
100
101 } // namespace sync_file_system
102
103 #endif // WEBKIT_FILEAPI_SYNCABLE_SYNCABLE_FILE_SYSTEM_UTIL_H_
OLDNEW
« no previous file with comments | « webkit/fileapi/syncable/syncable_file_system_unittest.cc ('k') | webkit/fileapi/syncable/syncable_file_system_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698