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 FileSystemFileUtil* file_system_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_system_file_util_(file_system_file_util), |
17 dest_file_system_file_util_(file_system_file_util), | 17 dest_file_system_file_util_(file_system_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) { | |
22 } | 21 } |
23 | 22 |
24 FileSystemOperationContext::~FileSystemOperationContext() { | 23 FileSystemOperationContext::~FileSystemOperationContext() { |
25 } | 24 } |
26 | 25 |
27 FileSystemOperationContext* | 26 FileSystemOperationContext* |
28 FileSystemOperationContext::CreateInheritedContextForDest() const { | 27 FileSystemOperationContext::CreateInheritedContextForDest() const { |
29 FileSystemOperationContext* context = new FileSystemOperationContext( | 28 FileSystemOperationContext* context = new FileSystemOperationContext( |
30 file_system_context_.get(), dest_file_system_file_util_); | 29 file_system_context_.get(), dest_file_system_file_util_); |
31 context->set_src_origin_url(dest_origin_url_); | 30 context->set_src_origin_url(dest_origin_url_); |
32 context->set_src_type(dest_type_); | 31 context->set_src_type(dest_type_); |
33 context->set_allowed_bytes_growth(allowed_bytes_growth_); | 32 context->set_allowed_bytes_growth(allowed_bytes_growth_); |
34 context->set_do_not_write_actually(do_not_write_actually_); | |
35 context->set_src_virtual_path(dest_virtual_path_); | 33 context->set_src_virtual_path(dest_virtual_path_); |
36 return context; | 34 return context; |
37 } | 35 } |
38 | 36 |
39 FileSystemOperationContext* | |
40 FileSystemOperationContext::CreateInheritedContextWithNewVirtualPaths( | |
41 const FilePath& new_src_virtual_path, | |
42 const FilePath& new_dest_virtual_path) const { | |
43 FileSystemOperationContext* context = new FileSystemOperationContext(*this); | |
44 context->set_src_virtual_path(new_src_virtual_path); | |
45 context->set_dest_virtual_path(new_dest_virtual_path); | |
46 return context; | |
47 } | |
48 | |
49 void FileSystemOperationContext::ImportAllowedBytesGrowth( | |
50 const FileSystemOperationContext& other) { | |
51 allowed_bytes_growth_ = other.allowed_bytes_growth(); | |
52 } | |
53 | |
54 } // namespace fileapi | 37 } // namespace fileapi |
OLD | NEW |