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

Side by Side Diff: chrome/browser/chromeos/file_system_provider/operations/open_file.h

Issue 284443002: [fsp] Add support for opening 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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 #ifndef CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_OPERATIONS_READ_DIRECTORY_H _ 5 #ifndef CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_OPERATIONS_OPEN_FILE_H_
6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_OPERATIONS_READ_DIRECTORY_H _ 6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_OPERATIONS_OPEN_FILE_H_
7 7
8 #include "base/files/file.h" 8 #include "base/files/file.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "chrome/browser/chromeos/file_system_provider/operations/operation.h" 10 #include "chrome/browser/chromeos/file_system_provider/operations/operation.h"
11 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_info .h" 11 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_info .h"
12 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_inte rface.h"
12 #include "chrome/browser/chromeos/file_system_provider/request_value.h" 13 #include "chrome/browser/chromeos/file_system_provider/request_value.h"
13 #include "webkit/browser/fileapi/async_file_util.h" 14 #include "webkit/browser/fileapi/async_file_util.h"
14 15
15 namespace base { 16 namespace base {
16 class FilePath; 17 class FilePath;
17 } // namespace base 18 } // namespace base
18 19
19 namespace extensions { 20 namespace extensions {
20 class EventRouter; 21 class EventRouter;
21 } // namespace extensions 22 } // namespace extensions
22 23
23 namespace chromeos { 24 namespace chromeos {
24 namespace file_system_provider { 25 namespace file_system_provider {
25 namespace operations { 26 namespace operations {
26 27
27 // Bridge between fileapi read directory operation and providing extension's 28 // Opens a file for either read or write, with optionally creating the file
28 // read directory request. Created per request. 29 // first. Note, that this is part of fileapi::CreateOrOpen file, but it does
29 class ReadDirectory : public Operation { 30 // not download the file locally. Created per request.
31 class OpenFile : public Operation {
30 public: 32 public:
31 ReadDirectory(extensions::EventRouter* event_router, 33 OpenFile(extensions::EventRouter* event_router,
32 const ProvidedFileSystemInfo& file_system_info, 34 const ProvidedFileSystemInfo& file_system_info,
33 const base::FilePath& directory_path, 35 const base::FilePath& file_path,
34 const fileapi::AsyncFileUtil::ReadDirectoryCallback& callback); 36 ProvidedFileSystemInterface::OpenFileMode mode,
35 virtual ~ReadDirectory(); 37 bool create,
38 const fileapi::AsyncFileUtil::StatusCallback& callback);
39 virtual ~OpenFile();
36 40
37 // Operation overrides. 41 // Operation overrides.
38 virtual bool Execute(int request_id) OVERRIDE; 42 virtual bool Execute(int request_id) OVERRIDE;
39 virtual void OnSuccess(int request_id, 43 virtual void OnSuccess(int request_id,
40 scoped_ptr<RequestValue> result, 44 scoped_ptr<RequestValue> result,
41 bool has_next) OVERRIDE; 45 bool has_next) OVERRIDE;
42 virtual void OnError(int request_id, base::File::Error error) OVERRIDE; 46 virtual void OnError(int request_id, base::File::Error error) OVERRIDE;
43 47
44 private: 48 private:
45 base::FilePath directory_path_; 49 base::FilePath file_path_;
46 const fileapi::AsyncFileUtil::ReadDirectoryCallback callback_; 50 ProvidedFileSystemInterface::OpenFileMode mode_;
51 bool create_;
52 const fileapi::AsyncFileUtil::StatusCallback callback_;
47 53
48 DISALLOW_COPY_AND_ASSIGN(ReadDirectory); 54 DISALLOW_COPY_AND_ASSIGN(OpenFile);
49 }; 55 };
50 56
51 } // namespace operations 57 } // namespace operations
52 } // namespace file_system_provider 58 } // namespace file_system_provider
53 } // namespace chromeos 59 } // namespace chromeos
54 60
55 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_OPERATIONS_READ_DIRECTOR Y_H_ 61 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_OPERATIONS_OPEN_FILE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698