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

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

Issue 11103031: webkit: Merge blob and fileapi into one build target 'storage' (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: _ Created 8 years, 2 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 (c) 2012 The Chromium Authors. All rights reserved. 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 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 WEBKIT_FILEAPI_SYNCABLE_SYNCABLE_FILE_SYSTEM_UTIL_H_ 5 #ifndef WEBKIT_FILEAPI_SYNCABLE_SYNCABLE_FILE_SYSTEM_UTIL_H_
6 #define WEBKIT_FILEAPI_SYNCABLE_SYNCABLE_FILE_SYSTEM_UTIL_H_ 6 #define WEBKIT_FILEAPI_SYNCABLE_SYNCABLE_FILE_SYSTEM_UTIL_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/file_path.h" 10 #include "base/file_path.h"
11 #include "webkit/fileapi/file_system_url.h" 11 #include "webkit/fileapi/file_system_url.h"
12 #include "webkit/fileapi/fileapi_export.h" 12 #include "webkit/storage/storage_export.h"
13 13
14 namespace fileapi { 14 namespace fileapi {
15 15
16 // Registers a syncable filesystem with the given |service_name|. 16 // Registers a syncable filesystem with the given |service_name|.
17 FILEAPI_EXPORT bool RegisterSyncableFileSystem(const std::string& service_name); 17 STORAGE_EXPORT bool RegisterSyncableFileSystem(const std::string& service_name);
18 18
19 // Revokes the syncable filesystem that was registered with |service_name|. 19 // Revokes the syncable filesystem that was registered with |service_name|.
20 FILEAPI_EXPORT bool RevokeSyncableFileSystem(const std::string& service_name); 20 STORAGE_EXPORT bool RevokeSyncableFileSystem(const std::string& service_name);
21 21
22 // Returns the root URI of the syncable filesystem that can be specified by a 22 // Returns the root URI of the syncable filesystem that can be specified by a
23 // pair of |origin| and |service_name|. 23 // pair of |origin| and |service_name|.
24 FILEAPI_EXPORT GURL GetSyncableFileSystemRootURI( 24 STORAGE_EXPORT GURL GetSyncableFileSystemRootURI(
25 const GURL& origin, const std::string& service_name); 25 const GURL& origin, const std::string& service_name);
26 26
27 // Creates a FileSystem URL for the |path| in a syncable filesystem 27 // Creates a FileSystem URL for the |path| in a syncable filesystem
28 // identifiable by a pair of |origin| and |service_name|. 28 // identifiable by a pair of |origin| and |service_name|.
29 // 29 //
30 // Example: Assume following arguments are given: 30 // Example: Assume following arguments are given:
31 // origin: 'http://www.example.com/', 31 // origin: 'http://www.example.com/',
32 // service_name: 'service_name', 32 // service_name: 'service_name',
33 // path: '/foo/bar', 33 // path: '/foo/bar',
34 // returns 'filesystem:http://www.example.com/external/service_name/foo/bar' 34 // returns 'filesystem:http://www.example.com/external/service_name/foo/bar'
35 FILEAPI_EXPORT FileSystemURL CreateSyncableFileSystemURL( 35 STORAGE_EXPORT FileSystemURL CreateSyncableFileSystemURL(
36 const GURL& origin, const std::string& service_name, const FilePath& path); 36 const GURL& origin, const std::string& service_name, const FilePath& path);
37 37
38 // Serializes a given FileSystemURL |url| and sets the serialized string to 38 // Serializes a given FileSystemURL |url| and sets the serialized string to
39 // |serialized_url|. If the URL does not represent a syncable filesystem, 39 // |serialized_url|. If the URL does not represent a syncable filesystem,
40 // |serialized_url| is not filled in, and returns false. Separators of the 40 // |serialized_url| is not filled in, and returns false. Separators of the
41 // path will be normalized depending on its platform. 41 // path will be normalized depending on its platform.
42 // 42 //
43 // Example: Assume a following FileSystemURL object is given: 43 // Example: Assume a following FileSystemURL object is given:
44 // origin() returns 'http://www.example.com/', 44 // origin() returns 'http://www.example.com/',
45 // type() returns the kFileSystemTypeSyncable, 45 // type() returns the kFileSystemTypeSyncable,
46 // filesystem_id() returns 'service_name', 46 // filesystem_id() returns 'service_name',
47 // path() returns '/foo/bar', 47 // path() returns '/foo/bar',
48 // this URL will be serialized to 48 // this URL will be serialized to
49 // (on Windows) 49 // (on Windows)
50 // 'filesystem:http://www.example.com/external/service_name/foo\\bar' 50 // 'filesystem:http://www.example.com/external/service_name/foo\\bar'
51 // (on others) 51 // (on others)
52 // 'filesystem:http://www.example.com/external/service_name/foo/bar' 52 // 'filesystem:http://www.example.com/external/service_name/foo/bar'
53 FILEAPI_EXPORT bool SerializeSyncableFileSystemURL( 53 STORAGE_EXPORT bool SerializeSyncableFileSystemURL(
54 const FileSystemURL& url, std::string* serialized_url); 54 const FileSystemURL& url, std::string* serialized_url);
55 55
56 // Deserializes a serialized FileSystem URL string |serialized_url| and sets the 56 // Deserializes a serialized FileSystem URL string |serialized_url| and sets the
57 // deserialized value to |url|. If the reconstructed object is invalid or does 57 // deserialized value to |url|. If the reconstructed object is invalid or does
58 // not represent a syncable filesystem, returns false. 58 // not represent a syncable filesystem, returns false.
59 // 59 //
60 // NOTE: On any platform other than Windows, this function assumes that 60 // NOTE: On any platform other than Windows, this function assumes that
61 // |serialized_url| does not contain '\\'. If it contains '\\' on such 61 // |serialized_url| does not contain '\\'. If it contains '\\' on such
62 // platforms, '\\' may be replaced with '/' (It would not be an expected 62 // platforms, '\\' may be replaced with '/' (It would not be an expected
63 // behavior). 63 // behavior).
64 // 64 //
65 // See the comment of SerializeSyncableFileSystemURL() for more details. 65 // See the comment of SerializeSyncableFileSystemURL() for more details.
66 FILEAPI_EXPORT bool DeserializeSyncableFileSystemURL( 66 STORAGE_EXPORT bool DeserializeSyncableFileSystemURL(
67 const std::string& serialized_url, FileSystemURL* url); 67 const std::string& serialized_url, FileSystemURL* url);
68 68
69 } // namespace fileapi 69 } // namespace fileapi
70 70
71 #endif // WEBKIT_FILEAPI_SYNCABLE_SYNCABLE_FILE_SYSTEM_UTIL_H_ 71 #endif // WEBKIT_FILEAPI_SYNCABLE_SYNCABLE_FILE_SYSTEM_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698