OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/file_system_operation_context.h" | 5 #include "webkit/fileapi/file_system_operation_context.h" |
6 | 6 |
7 #include "webkit/fileapi/file_system_context.h" | 7 #include "webkit/fileapi/file_system_context.h" |
8 #include "webkit/fileapi/file_system_util.h" | 8 #include "webkit/fileapi/file_system_util.h" |
9 | 9 |
10 namespace fileapi { | 10 namespace fileapi { |
11 | 11 |
12 FileSystemOperationContext::FileSystemOperationContext( | 12 FileSystemOperationContext::FileSystemOperationContext( |
13 FileSystemContext* context, | 13 FileSystemContext* context, |
14 FileSystemFileUtil* file_system_file_util) | 14 FileApiFileUtil* file_util) |
15 : file_system_context_(context), | 15 : file_system_context_(context), |
16 src_file_system_file_util_(file_system_file_util), | 16 src_file_util_(file_util), |
17 dest_file_system_file_util_(file_system_file_util), | 17 dest_file_util_(file_util), |
18 src_type_(kFileSystemTypeUnknown), | 18 src_type_(kFileSystemTypeUnknown), |
19 dest_type_(kFileSystemTypeUnknown), | 19 dest_type_(kFileSystemTypeUnknown), |
20 allowed_bytes_growth_(0), | 20 allowed_bytes_growth_(0), |
21 do_not_write_actually_(false) { | 21 do_not_write_actually_(false) { |
22 } | 22 } |
23 | 23 |
24 FileSystemOperationContext::~FileSystemOperationContext() { | 24 FileSystemOperationContext::~FileSystemOperationContext() { |
25 } | 25 } |
26 | 26 |
27 FileSystemOperationContext* | 27 FileSystemOperationContext* |
28 FileSystemOperationContext::CreateInheritedContextForDest() const { | 28 FileSystemOperationContext::CreateInheritedContextForDest() const { |
29 FileSystemOperationContext* context = new FileSystemOperationContext( | 29 FileSystemOperationContext* context = new FileSystemOperationContext( |
30 file_system_context_.get(), dest_file_system_file_util_); | 30 file_system_context_.get(), dest_file_util_); |
31 context->set_src_origin_url(dest_origin_url_); | 31 context->set_src_origin_url(dest_origin_url_); |
32 context->set_src_type(dest_type_); | 32 context->set_src_type(dest_type_); |
33 context->set_allowed_bytes_growth(allowed_bytes_growth_); | 33 context->set_allowed_bytes_growth(allowed_bytes_growth_); |
34 context->set_do_not_write_actually(do_not_write_actually_); | 34 context->set_do_not_write_actually(do_not_write_actually_); |
35 context->set_src_virtual_path(dest_virtual_path_); | 35 context->set_src_virtual_path(dest_virtual_path_); |
36 return context; | 36 return context; |
37 } | 37 } |
38 | 38 |
39 FileSystemOperationContext* | 39 FileSystemOperationContext* |
40 FileSystemOperationContext::CreateInheritedContextWithNewVirtualPaths( | 40 FileSystemOperationContext::CreateInheritedContextWithNewVirtualPaths( |
41 const FilePath& new_src_virtual_path, | 41 const FilePath& new_src_virtual_path, |
42 const FilePath& new_dest_virtual_path) const { | 42 const FilePath& new_dest_virtual_path) const { |
43 FileSystemOperationContext* context = new FileSystemOperationContext(*this); | 43 FileSystemOperationContext* context = new FileSystemOperationContext(*this); |
44 context->set_src_virtual_path(new_src_virtual_path); | 44 context->set_src_virtual_path(new_src_virtual_path); |
45 context->set_dest_virtual_path(new_dest_virtual_path); | 45 context->set_dest_virtual_path(new_dest_virtual_path); |
46 return context; | 46 return context; |
47 } | 47 } |
48 | 48 |
49 void FileSystemOperationContext::ImportAllowedBytesGrowth( | 49 void FileSystemOperationContext::ImportAllowedBytesGrowth( |
50 const FileSystemOperationContext& other) { | 50 const FileSystemOperationContext& other) { |
51 allowed_bytes_growth_ = other.allowed_bytes_growth(); | 51 allowed_bytes_growth_ = other.allowed_bytes_growth(); |
52 } | 52 } |
53 | 53 |
54 } // namespace fileapi | 54 } // namespace fileapi |
OLD | NEW |