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

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

Issue 12163003: Add FilePath to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 #include "webkit/fileapi/syncable/syncable_file_system_util.h" 5 #include "webkit/fileapi/syncable/syncable_file_system_util.h"
6 6
7 #include "webkit/fileapi/external_mount_points.h" 7 #include "webkit/fileapi/external_mount_points.h"
8 #include "webkit/fileapi/file_observers.h" 8 #include "webkit/fileapi/file_observers.h"
9 #include "webkit/fileapi/file_system_context.h" 9 #include "webkit/fileapi/file_system_context.h"
10 #include "webkit/fileapi/file_system_util.h" 10 #include "webkit/fileapi/file_system_util.h"
11 #include "webkit/fileapi/sandbox_mount_point_provider.h" 11 #include "webkit/fileapi/sandbox_mount_point_provider.h"
12 12
13 namespace fileapi { 13 namespace fileapi {
14 14
15 bool RegisterSyncableFileSystem(const std::string& service_name) { 15 bool RegisterSyncableFileSystem(const std::string& service_name) {
16 return ExternalMountPoints::GetSystemInstance()->RegisterFileSystem( 16 return ExternalMountPoints::GetSystemInstance()->RegisterFileSystem(
17 service_name, kFileSystemTypeSyncable, FilePath()); 17 service_name, kFileSystemTypeSyncable, base::FilePath());
18 } 18 }
19 19
20 bool RevokeSyncableFileSystem(const std::string& service_name) { 20 bool RevokeSyncableFileSystem(const std::string& service_name) {
21 return ExternalMountPoints::GetSystemInstance()->RevokeFileSystem( 21 return ExternalMountPoints::GetSystemInstance()->RevokeFileSystem(
22 service_name); 22 service_name);
23 } 23 }
24 24
25 GURL GetSyncableFileSystemRootURI(const GURL& origin, 25 GURL GetSyncableFileSystemRootURI(const GURL& origin,
26 const std::string& service_name) { 26 const std::string& service_name) {
27 const GURL url = GetFileSystemRootURI(origin, kFileSystemTypeExternal); 27 const GURL url = GetFileSystemRootURI(origin, kFileSystemTypeExternal);
28 const std::string path = service_name + "/"; 28 const std::string path = service_name + "/";
29 url_canon::Replacements<char> replacements; 29 url_canon::Replacements<char> replacements;
30 replacements.SetPath(path.c_str(), url_parse::Component(0, path.length())); 30 replacements.SetPath(path.c_str(), url_parse::Component(0, path.length()));
31 return url.ReplaceComponents(replacements); 31 return url.ReplaceComponents(replacements);
32 } 32 }
33 33
34 FileSystemURL CreateSyncableFileSystemURL(const GURL& origin, 34 FileSystemURL CreateSyncableFileSystemURL(const GURL& origin,
35 const std::string& service_name, 35 const std::string& service_name,
36 const FilePath& path) { 36 const base::FilePath& path) {
37 return ExternalMountPoints::GetSystemInstance()->CreateCrackedFileSystemURL( 37 return ExternalMountPoints::GetSystemInstance()->CreateCrackedFileSystemURL(
38 origin, 38 origin,
39 kFileSystemTypeExternal, 39 kFileSystemTypeExternal,
40 FilePath::FromUTF8Unsafe(service_name).Append(path)); 40 base::FilePath::FromUTF8Unsafe(service_name).Append(path));
41 } 41 }
42 42
43 bool SerializeSyncableFileSystemURL(const FileSystemURL& url, 43 bool SerializeSyncableFileSystemURL(const FileSystemURL& url,
44 std::string* serialized_url) { 44 std::string* serialized_url) {
45 if (!url.is_valid() || url.type() != kFileSystemTypeSyncable) 45 if (!url.is_valid() || url.type() != kFileSystemTypeSyncable)
46 return false; 46 return false;
47 *serialized_url = 47 *serialized_url =
48 GetSyncableFileSystemRootURI(url.origin(), url.filesystem_id()).spec() + 48 GetSyncableFileSystemRootURI(url.origin(), url.filesystem_id()).spec() +
49 url.path().AsUTF8Unsafe(); 49 url.path().AsUTF8Unsafe();
50 return true; 50 return true;
(...skipping 17 matching lines...) Expand all
68 } 68 }
69 69
70 LocalFileSystemOperation* 70 LocalFileSystemOperation*
71 CreateFileSystemOperationForSync(FileSystemContext* file_system_context) { 71 CreateFileSystemOperationForSync(FileSystemContext* file_system_context) {
72 DCHECK(file_system_context); 72 DCHECK(file_system_context);
73 return file_system_context->sandbox_provider()-> 73 return file_system_context->sandbox_provider()->
74 CreateFileSystemOperationForSync(file_system_context); 74 CreateFileSystemOperationForSync(file_system_context);
75 } 75 }
76 76
77 } // namespace fileapi 77 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/fileapi/syncable/syncable_file_system_util.h ('k') | webkit/fileapi/syncable/syncable_file_system_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698