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/isolated_mount_point_provider.cc

Issue 10082002: Add FileSystemMountPointProvider::CreateFileReader() which returns appropriate Reader instance (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 8 years, 8 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/isolated_mount_point_provider.h" 5 #include "webkit/fileapi/isolated_mount_point_provider.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/message_loop_proxy.h" 12 #include "base/message_loop_proxy.h"
13 #include "googleurl/src/gurl.h" 13 #include "googleurl/src/gurl.h"
14 #include "webkit/blob/local_file_reader.h"
14 #include "webkit/fileapi/file_system_callback_dispatcher.h" 15 #include "webkit/fileapi/file_system_callback_dispatcher.h"
16 #include "webkit/fileapi/file_system_file_reader.h"
15 #include "webkit/fileapi/file_system_operation.h" 17 #include "webkit/fileapi/file_system_operation.h"
16 #include "webkit/fileapi/file_system_types.h" 18 #include "webkit/fileapi/file_system_types.h"
19 #include "webkit/fileapi/file_system_util.h"
17 #include "webkit/fileapi/isolated_context.h" 20 #include "webkit/fileapi/isolated_context.h"
18 #include "webkit/fileapi/isolated_file_util.h" 21 #include "webkit/fileapi/isolated_file_util.h"
19 #include "webkit/fileapi/native_file_util.h" 22 #include "webkit/fileapi/native_file_util.h"
20 23
21 namespace fileapi { 24 namespace fileapi {
22 25
23 IsolatedMountPointProvider::IsolatedMountPointProvider() 26 IsolatedMountPointProvider::IsolatedMountPointProvider()
24 : isolated_file_util_(new IsolatedFileUtil(new NativeFileUtil())) { 27 : isolated_file_util_(new IsolatedFileUtil(new NativeFileUtil())) {
25 } 28 }
26 29
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 FileSystemOperationInterface* 93 FileSystemOperationInterface*
91 IsolatedMountPointProvider::CreateFileSystemOperation( 94 IsolatedMountPointProvider::CreateFileSystemOperation(
92 const GURL& origin_url, 95 const GURL& origin_url,
93 FileSystemType file_system_type, 96 FileSystemType file_system_type,
94 const FilePath& virtual_path, 97 const FilePath& virtual_path,
95 base::MessageLoopProxy* file_proxy, 98 base::MessageLoopProxy* file_proxy,
96 FileSystemContext* context) const { 99 FileSystemContext* context) const {
97 return new FileSystemOperation(file_proxy, context); 100 return new FileSystemOperation(file_proxy, context);
98 } 101 }
99 102
103 webkit_blob::FileReader* IsolatedMountPointProvider::CreateFileReader(
104 const GURL& url,
105 int64 offset,
106 base::MessageLoopProxy* file_proxy,
107 FileSystemContext* context) const {
108 GURL origin_url;
109 FileSystemType file_system_type = kFileSystemTypeUnknown;
110 FilePath virtual_path;
111 if (!CrackFileSystemURL(url, &origin_url, &file_system_type, &virtual_path))
112 return NULL;
113 std::string fsid;
114 FilePath path;
115 if (!isolated_context()->CrackIsolatedPath(virtual_path, &fsid, NULL, &path))
116 return NULL;
117 if (path.empty())
118 return NULL;
119 return new webkit_blob::LocalFileReader(
120 file_proxy, path, offset, base::Time());
121 }
122
100 IsolatedContext* IsolatedMountPointProvider::isolated_context() const { 123 IsolatedContext* IsolatedMountPointProvider::isolated_context() const {
101 return IsolatedContext::GetInstance(); 124 return IsolatedContext::GetInstance();
102 } 125 }
103 126
104 } // namespace fileapi 127 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/fileapi/isolated_mount_point_provider.h ('k') | webkit/fileapi/sandbox_mount_point_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698