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

Unified Diff: chrome/browser/chromeos/file_system_provider/operations/read_file.h

Issue 287673004: [fsp] First part of support for reading files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/file_system_provider/operations/read_file.h
diff --git a/chrome/browser/chromeos/file_system_provider/operations/close_file.h b/chrome/browser/chromeos/file_system_provider/operations/read_file.h
similarity index 65%
copy from chrome/browser/chromeos/file_system_provider/operations/close_file.h
copy to chrome/browser/chromeos/file_system_provider/operations/read_file.h
index 81502095df679325422b0206013d762605143a7e..f3cccaec03886d9fe311623147422337f59a0752 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/close_file.h
+++ b/chrome/browser/chromeos/file_system_provider/operations/read_file.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_OPERATIONS_CLOSE_FILE_H_
-#define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_OPERATIONS_CLOSE_FILE_H_
+#ifndef CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_OPERATIONS_READ_FILE_H_
+#define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_OPERATIONS_READ_FILE_H_
#include "base/files/file.h"
#include "base/memory/scoped_ptr.h"
@@ -11,6 +11,7 @@
#include "chrome/browser/chromeos/file_system_provider/provided_file_system_info.h"
#include "chrome/browser/chromeos/file_system_provider/provided_file_system_interface.h"
#include "chrome/browser/chromeos/file_system_provider/request_value.h"
+#include "net/base/io_buffer.h"
#include "webkit/browser/fileapi/async_file_util.h"
namespace base {
@@ -25,16 +26,19 @@ namespace chromeos {
namespace file_system_provider {
namespace operations {
-// Opens a file for either read or write, with optionally creating the file
-// first. Note, that this is part of fileapi::CreateOrOpen file, but it does
-// not download the file locally. Created per request.
-class CloseFile : public Operation {
+// Bridge between fileapi read file and providing extension's read fil request.
+// Created per request.
+class ReadFile : public Operation {
public:
- CloseFile(extensions::EventRouter* event_router,
- const ProvidedFileSystemInfo& file_system_info,
- int open_request_id,
- const fileapi::AsyncFileUtil::StatusCallback& callback);
- virtual ~CloseFile();
+ ReadFile(
+ extensions::EventRouter* event_router,
+ const ProvidedFileSystemInfo& file_system_info,
+ int file_handle,
+ net::IOBuffer* buffer,
+ int64 offset,
+ int length,
+ const ProvidedFileSystemInterface::ReadChunkReceivedCallback& callback);
+ virtual ~ReadFile();
// Operation overrides.
virtual bool Execute(int request_id) OVERRIDE;
@@ -44,14 +48,18 @@ class CloseFile : public Operation {
virtual void OnError(int request_id, base::File::Error error) OVERRIDE;
private:
- int open_request_id_;
- const fileapi::AsyncFileUtil::StatusCallback callback_;
+ int file_handle_;
+ net::IOBuffer* buffer_;
+ int64 offset_;
+ int length_;
+ int64 current_offset_;
+ const ProvidedFileSystemInterface::ReadChunkReceivedCallback callback_;
- DISALLOW_COPY_AND_ASSIGN(CloseFile);
+ DISALLOW_COPY_AND_ASSIGN(ReadFile);
};
} // namespace operations
} // namespace file_system_provider
} // namespace chromeos
-#endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_OPERATIONS_CLOSE_FILE_H_
+#endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_OPERATIONS_READ_FILE_H_

Powered by Google App Engine
This is Rietveld 408576698