summaryrefslogtreecommitdiffstats
path: root/webkit/fileapi/file_system_operation_context.cc
blob: bfd50554b080efb20cb06357b18a5c77c8e30091 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "webkit/fileapi/file_system_operation_context.h"

#include "webkit/fileapi/file_system_context.h"
#include "webkit/fileapi/file_system_util.h"

namespace fileapi {

FileSystemOperationContext::FileSystemOperationContext(
    FileSystemContext* context,
    FileSystemFileUtil* file_system_file_util)
    : file_system_context_(context),
      src_file_system_file_util_(file_system_file_util),
      dest_file_system_file_util_(file_system_file_util),
      src_type_(kFileSystemTypeUnknown),
      dest_type_(kFileSystemTypeUnknown),
      allowed_bytes_growth_(0),
      do_not_write_actually_(false) {
}

FileSystemOperationContext::~FileSystemOperationContext() {
}

FileSystemOperationContext*
FileSystemOperationContext::CreateInheritedContextForDest() const {
  FileSystemOperationContext* context = new FileSystemOperationContext(
      file_system_context_.get(), dest_file_system_file_util_);
  context->set_src_origin_url(dest_origin_url_);
  context->set_src_type(dest_type_);
  context->set_allowed_bytes_growth(allowed_bytes_growth_);
  context->set_do_not_write_actually(do_not_write_actually_);
  context->set_src_virtual_path(dest_virtual_path_);
  return context;
}

FileSystemOperationContext*
FileSystemOperationContext::CreateInheritedContextWithNewVirtualPaths(
    const FilePath& new_src_virtual_path,
    const FilePath& new_dest_virtual_path) const {
  FileSystemOperationContext* context = new FileSystemOperationContext(*this);
  context->set_src_virtual_path(new_src_virtual_path);
  context->set_dest_virtual_path(new_dest_virtual_path);
  return context;
}

void FileSystemOperationContext::ImportAllowedBytesGrowth(
    const FileSystemOperationContext& other) {
  allowed_bytes_growth_ = other.allowed_bytes_growth();
}

}  // namespace fileapi