1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_OPERATIONS_WRITE_FILE_H_
6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_OPERATIONS_WRITE_FILE_H_
8 #include "base/files/file.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "chrome/browser/chromeos/file_system_provider/operations/operation.h"
12 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_info.h"
13 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_interface.h"
14 #include "chrome/browser/chromeos/file_system_provider/request_value.h"
15 #include "net/base/io_buffer.h"
16 #include "storage/browser/fileapi/async_file_util.h"
22 namespace extensions
{
24 } // namespace extensions
27 namespace file_system_provider
{
28 namespace operations
{
30 // Bridge between fileapi write file and providing extension's write fil
32 // Created per request.
33 class WriteFile
: public Operation
{
35 WriteFile(extensions::EventRouter
* event_router
,
36 const ProvidedFileSystemInfo
& file_system_info
,
38 scoped_refptr
<net::IOBuffer
> buffer
,
41 const storage::AsyncFileUtil::StatusCallback
& callback
);
42 ~WriteFile() override
;
44 // Operation overrides.
45 bool Execute(int request_id
) override
;
46 void OnSuccess(int request_id
,
47 scoped_ptr
<RequestValue
> result
,
48 bool has_more
) override
;
49 void OnError(int request_id
,
50 scoped_ptr
<RequestValue
> result
,
51 base::File::Error error
) override
;
55 scoped_refptr
<net::IOBuffer
> buffer_
;
58 const storage::AsyncFileUtil::StatusCallback callback_
;
60 DISALLOW_COPY_AND_ASSIGN(WriteFile
);
63 } // namespace operations
64 } // namespace file_system_provider
65 } // namespace chromeos
67 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_OPERATIONS_WRITE_FILE_H_