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

Side by Side Diff: webkit/common/fileapi/file_system_util.cc

Issue 23463048: Implement stream based cross file system copy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 #include "webkit/common/fileapi/file_system_util.h" 5 #include "webkit/common/fileapi/file_system_util.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
12 #include "base/strings/sys_string_conversions.h" 12 #include "base/strings/sys_string_conversions.h"
13 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "net/base/net_errors.h"
14 #include "url/gurl.h" 15 #include "url/gurl.h"
15 #include "webkit/common/database/database_identifier.h" 16 #include "webkit/common/database/database_identifier.h"
16 17
17 namespace fileapi { 18 namespace fileapi {
18 19
19 const char kPersistentDir[] = "/persistent"; 20 const char kPersistentDir[] = "/persistent";
20 const char kTemporaryDir[] = "/temporary"; 21 const char kTemporaryDir[] = "/temporary";
21 const char kIsolatedDir[] = "/isolated"; 22 const char kIsolatedDir[] = "/isolated";
22 const char kExternalDir[] = "/external"; 23 const char kExternalDir[] = "/external";
23 const char kTestDir[] = "/test"; 24 const char kTestDir[] = "/test";
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 const std::string& mount_name) { 390 const std::string& mount_name) {
390 std::string root = GetFileSystemRootURI(origin_url, 391 std::string root = GetFileSystemRootURI(origin_url,
391 kFileSystemTypeExternal).spec(); 392 kFileSystemTypeExternal).spec();
392 if (base::FilePath::FromUTF8Unsafe(mount_name).ReferencesParent()) 393 if (base::FilePath::FromUTF8Unsafe(mount_name).ReferencesParent())
393 return std::string(); 394 return std::string();
394 root.append(mount_name); 395 root.append(mount_name);
395 root.append("/"); 396 root.append("/");
396 return root; 397 return root;
397 } 398 }
398 399
400 base::PlatformFileError NetErrorToPlatformFileError(int error) {
kinuko 2013/09/23 22:10:20 It's really great if you could split this CL. (Yo
hidehiko 2013/09/24 02:06:15 Done. crrev.com/24300003 I'll rebase this onto it
401 switch (error) {
402 case net::OK:
403 return base::PLATFORM_FILE_OK;
404 case net::ERR_ADDRESS_IN_USE:
405 return base::PLATFORM_FILE_ERROR_IN_USE;
406 case net::ERR_FILE_EXISTS:
407 return base::PLATFORM_FILE_ERROR_EXISTS;
408 case net::ERR_FILE_NOT_FOUND:
409 return base::PLATFORM_FILE_ERROR_NOT_FOUND;
410 case net::ERR_ACCESS_DENIED:
411 return base::PLATFORM_FILE_ERROR_ACCESS_DENIED;
412 case net::ERR_TOO_MANY_SOCKET_STREAMS:
413 return base::PLATFORM_FILE_ERROR_TOO_MANY_OPENED;
414 case net::ERR_OUT_OF_MEMORY:
415 return base::PLATFORM_FILE_ERROR_NO_MEMORY;
416 case net::ERR_FILE_NO_SPACE:
417 return base::PLATFORM_FILE_ERROR_NO_SPACE;
418 case net::ERR_INVALID_ARGUMENT:
419 case net::ERR_INVALID_HANDLE:
420 return base::PLATFORM_FILE_ERROR_INVALID_OPERATION;
421 case net::ERR_ABORTED:
422 case net::ERR_CONNECTION_ABORTED:
423 return base::PLATFORM_FILE_ERROR_ABORT;
424 case net::ERR_ADDRESS_INVALID:
425 case net::ERR_INVALID_URL:
426 return base::PLATFORM_FILE_ERROR_INVALID_URL;
427 default:
428 return base::PLATFORM_FILE_ERROR_FAILED;
429 }
430 }
431
399 } // namespace fileapi 432 } // namespace fileapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698