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

Side by Side Diff: webkit/chromeos/fileapi/cros_mount_point_provider.cc

Issue 10447083: Rename webkit_blob::FileReader to FileStreamReader. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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
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/chromeos/fileapi/cros_mount_point_provider.h" 5 #include "webkit/chromeos/fileapi/cros_mount_point_provider.h"
6 6
7 #include "base/chromeos/chromeos_version.h" 7 #include "base/chromeos/chromeos_version.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
11 #include "base/stringprintf.h" 11 #include "base/stringprintf.h"
12 #include "base/synchronization/lock.h" 12 #include "base/synchronization/lock.h"
13 #include "base/utf_string_conversions.h" 13 #include "base/utf_string_conversions.h"
14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h"
15 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCString.h " 15 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCString.h "
16 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebFileSyste m.h" 16 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebFileSyste m.h"
17 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" 17 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
18 #include "webkit/chromeos/fileapi/file_access_permissions.h" 18 #include "webkit/chromeos/fileapi/file_access_permissions.h"
19 #include "webkit/chromeos/fileapi/remote_file_system_operation.h" 19 #include "webkit/chromeos/fileapi/remote_file_system_operation.h"
20 #include "webkit/fileapi/file_system_file_reader.h" 20 #include "webkit/fileapi/file_system_file_stream_reader.h"
21 #include "webkit/fileapi/file_system_operation.h" 21 #include "webkit/fileapi/file_system_operation.h"
22 #include "webkit/fileapi/file_system_util.h" 22 #include "webkit/fileapi/file_system_util.h"
23 #include "webkit/glue/webkit_glue.h" 23 #include "webkit/glue/webkit_glue.h"
24 24
25 namespace { 25 namespace {
26 26
27 const char kChromeUIScheme[] = "chrome"; 27 const char kChromeUIScheme[] = "chrome";
28 28
29 // Returns the home directory path, or an empty string if the home directory 29 // Returns the home directory path, or an empty string if the home directory
30 // is not found. 30 // is not found.
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 fileapi::FileSystemType file_system_type, 247 fileapi::FileSystemType file_system_type,
248 const FilePath& virtual_path, 248 const FilePath& virtual_path,
249 fileapi::FileSystemContext* context) const { 249 fileapi::FileSystemContext* context) const {
250 const MountPoint* mount_point = GetMountPoint(virtual_path); 250 const MountPoint* mount_point = GetMountPoint(virtual_path);
251 if (mount_point && mount_point->location == REMOTE) 251 if (mount_point && mount_point->location == REMOTE)
252 return new chromeos::RemoteFileSystemOperation(mount_point->remote_proxy); 252 return new chromeos::RemoteFileSystemOperation(mount_point->remote_proxy);
253 253
254 return new fileapi::FileSystemOperation(context); 254 return new fileapi::FileSystemOperation(context);
255 } 255 }
256 256
257 webkit_blob::FileReader* CrosMountPointProvider::CreateFileReader( 257 webkit_blob::FileStreamReader* CrosMountPointProvider::CreateFileStreamReader(
258 const GURL& url, 258 const GURL& url,
259 int64 offset, 259 int64 offset,
260 fileapi::FileSystemContext* context) const { 260 fileapi::FileSystemContext* context) const {
261 // For now we return a generic Reader implementation which utilizes 261 // For now we return a generic Reader implementation which utilizes
262 // CreateSnapshotFile internally (i.e. will download everything first). 262 // CreateSnapshotFile internally (i.e. will download everything first).
263 // TODO(satorux,zel): implement more efficient reader for remote cases. 263 // TODO(satorux,zel): implement more efficient reader for remote cases.
264 return new fileapi::FileSystemFileReader(context, url, offset); 264 return new fileapi::FileSystemFileStreamReader(context, url, offset);
kinuko 2012/05/30 14:34:36 Oops this is long... though I don't have a better
kinaba 2012/05/31 01:35:56 Neither do I...
265 } 265 }
266 266
267 fileapi::FileWriter* CrosMountPointProvider::CreateFileWriter( 267 fileapi::FileWriter* CrosMountPointProvider::CreateFileWriter(
268 const GURL& url, 268 const GURL& url,
269 int64 offset, 269 int64 offset,
270 fileapi::FileSystemContext* context) const { 270 fileapi::FileSystemContext* context) const {
271 // TODO(kinaba,kinuko,benchan,satorux): return a writer for remote or local 271 // TODO(kinaba,kinuko,benchan,satorux): return a writer for remote or local
272 // file system depending on the mount point location. 272 // file system depending on the mount point location.
273 NOTIMPLEMENTED(); 273 NOTIMPLEMENTED();
274 return NULL; 274 return NULL;
275 } 275 }
276 276
277 bool CrosMountPointProvider::GetVirtualPath(const FilePath& filesystem_path, 277 bool CrosMountPointProvider::GetVirtualPath(const FilePath& filesystem_path,
278 FilePath* virtual_path) { 278 FilePath* virtual_path) {
279 for (MountPointMap::const_iterator iter = mount_point_map_.begin(); 279 for (MountPointMap::const_iterator iter = mount_point_map_.begin();
280 iter != mount_point_map_.end(); 280 iter != mount_point_map_.end();
281 ++iter) { 281 ++iter) {
282 FilePath mount_prefix = iter->second.local_root_path.Append(iter->first); 282 FilePath mount_prefix = iter->second.local_root_path.Append(iter->first);
283 *virtual_path = FilePath(iter->first); 283 *virtual_path = FilePath(iter->first);
284 if (mount_prefix == filesystem_path) { 284 if (mount_prefix == filesystem_path) {
285 return true; 285 return true;
286 } else if (mount_prefix.AppendRelativePath(filesystem_path, virtual_path)) { 286 } else if (mount_prefix.AppendRelativePath(filesystem_path, virtual_path)) {
287 return true; 287 return true;
288 } 288 }
289 } 289 }
290 return false; 290 return false;
291 } 291 }
292 292
293 } // namespace chromeos 293 } // namespace chromeos
OLDNEW
« no previous file with comments | « webkit/chromeos/fileapi/cros_mount_point_provider.h ('k') | webkit/fileapi/file_system_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698