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

Side by Side Diff: chrome/browser/chromeos/file_system_provider/fake_provided_file_system.h

Issue 492873002: Collapse fileapi, webkit_blob, webkit_database, quota, and webkit_common namespaces into single sto… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix chromeos build Created 6 years, 4 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_FAKE_PROVIDED_FILE_SYSTEM_H _ 5 #ifndef CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FAKE_PROVIDED_FILE_SYSTEM_H _
6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FAKE_PROVIDED_FILE_SYSTEM_H _ 6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FAKE_PROVIDED_FILE_SYSTEM_H _
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 std::string mime_type, 64 std::string mime_type,
65 std::string contents); 65 std::string contents);
66 66
67 // Fetches a pointer to a fake entry registered in the fake file system. If 67 // Fetches a pointer to a fake entry registered in the fake file system. If
68 // found, then the result is written to |fake_entry| and true is returned. 68 // found, then the result is written to |fake_entry| and true is returned.
69 // Otherwise, false is returned. |fake_entry| must not be NULL. 69 // Otherwise, false is returned. |fake_entry| must not be NULL.
70 bool GetEntry(const base::FilePath& entry_path, FakeEntry* fake_entry) const; 70 bool GetEntry(const base::FilePath& entry_path, FakeEntry* fake_entry) const;
71 71
72 // ProvidedFileSystemInterface overrides. 72 // ProvidedFileSystemInterface overrides.
73 virtual AbortCallback RequestUnmount( 73 virtual AbortCallback RequestUnmount(
74 const fileapi::AsyncFileUtil::StatusCallback& callback) OVERRIDE; 74 const storage::AsyncFileUtil::StatusCallback& callback) OVERRIDE;
75 virtual AbortCallback GetMetadata( 75 virtual AbortCallback GetMetadata(
76 const base::FilePath& entry_path, 76 const base::FilePath& entry_path,
77 const ProvidedFileSystemInterface::GetMetadataCallback& callback) 77 const ProvidedFileSystemInterface::GetMetadataCallback& callback)
78 OVERRIDE; 78 OVERRIDE;
79 virtual AbortCallback ReadDirectory( 79 virtual AbortCallback ReadDirectory(
80 const base::FilePath& directory_path, 80 const base::FilePath& directory_path,
81 const fileapi::AsyncFileUtil::ReadDirectoryCallback& callback) OVERRIDE; 81 const storage::AsyncFileUtil::ReadDirectoryCallback& callback) OVERRIDE;
82 virtual AbortCallback OpenFile(const base::FilePath& file_path, 82 virtual AbortCallback OpenFile(const base::FilePath& file_path,
83 OpenFileMode mode, 83 OpenFileMode mode,
84 const OpenFileCallback& callback) OVERRIDE; 84 const OpenFileCallback& callback) OVERRIDE;
85 virtual AbortCallback CloseFile( 85 virtual AbortCallback CloseFile(
86 int file_handle, 86 int file_handle,
87 const fileapi::AsyncFileUtil::StatusCallback& callback) OVERRIDE; 87 const storage::AsyncFileUtil::StatusCallback& callback) OVERRIDE;
88 virtual AbortCallback ReadFile( 88 virtual AbortCallback ReadFile(
89 int file_handle, 89 int file_handle,
90 net::IOBuffer* buffer, 90 net::IOBuffer* buffer,
91 int64 offset, 91 int64 offset,
92 int length, 92 int length,
93 const ReadChunkReceivedCallback& callback) OVERRIDE; 93 const ReadChunkReceivedCallback& callback) OVERRIDE;
94 virtual AbortCallback CreateDirectory( 94 virtual AbortCallback CreateDirectory(
95 const base::FilePath& directory_path, 95 const base::FilePath& directory_path,
96 bool exclusive, 96 bool exclusive,
97 bool recursive, 97 bool recursive,
98 const fileapi::AsyncFileUtil::StatusCallback& callback) OVERRIDE; 98 const storage::AsyncFileUtil::StatusCallback& callback) OVERRIDE;
99 virtual AbortCallback DeleteEntry( 99 virtual AbortCallback DeleteEntry(
100 const base::FilePath& entry_path, 100 const base::FilePath& entry_path,
101 bool recursive, 101 bool recursive,
102 const fileapi::AsyncFileUtil::StatusCallback& callback) OVERRIDE; 102 const storage::AsyncFileUtil::StatusCallback& callback) OVERRIDE;
103 virtual AbortCallback CreateFile( 103 virtual AbortCallback CreateFile(
104 const base::FilePath& file_path, 104 const base::FilePath& file_path,
105 const fileapi::AsyncFileUtil::StatusCallback& callback) OVERRIDE; 105 const storage::AsyncFileUtil::StatusCallback& callback) OVERRIDE;
106 virtual AbortCallback CopyEntry( 106 virtual AbortCallback CopyEntry(
107 const base::FilePath& source_path, 107 const base::FilePath& source_path,
108 const base::FilePath& target_path, 108 const base::FilePath& target_path,
109 const fileapi::AsyncFileUtil::StatusCallback& callback) OVERRIDE; 109 const storage::AsyncFileUtil::StatusCallback& callback) OVERRIDE;
110 virtual AbortCallback MoveEntry( 110 virtual AbortCallback MoveEntry(
111 const base::FilePath& source_path, 111 const base::FilePath& source_path,
112 const base::FilePath& target_path, 112 const base::FilePath& target_path,
113 const fileapi::AsyncFileUtil::StatusCallback& callback) OVERRIDE; 113 const storage::AsyncFileUtil::StatusCallback& callback) OVERRIDE;
114 virtual AbortCallback Truncate( 114 virtual AbortCallback Truncate(
115 const base::FilePath& file_path, 115 const base::FilePath& file_path,
116 int64 length, 116 int64 length,
117 const fileapi::AsyncFileUtil::StatusCallback& callback) OVERRIDE; 117 const storage::AsyncFileUtil::StatusCallback& callback) OVERRIDE;
118 virtual AbortCallback WriteFile( 118 virtual AbortCallback WriteFile(
119 int file_handle, 119 int file_handle,
120 net::IOBuffer* buffer, 120 net::IOBuffer* buffer,
121 int64 offset, 121 int64 offset,
122 int length, 122 int length,
123 const fileapi::AsyncFileUtil::StatusCallback& callback) OVERRIDE; 123 const storage::AsyncFileUtil::StatusCallback& callback) OVERRIDE;
124 virtual const ProvidedFileSystemInfo& GetFileSystemInfo() const OVERRIDE; 124 virtual const ProvidedFileSystemInfo& GetFileSystemInfo() const OVERRIDE;
125 virtual RequestManager* GetRequestManager() OVERRIDE; 125 virtual RequestManager* GetRequestManager() OVERRIDE;
126 virtual base::WeakPtr<ProvidedFileSystemInterface> GetWeakPtr() OVERRIDE; 126 virtual base::WeakPtr<ProvidedFileSystemInterface> GetWeakPtr() OVERRIDE;
127 127
128 // Factory callback, to be used in Service::SetFileSystemFactory(). The 128 // Factory callback, to be used in Service::SetFileSystemFactory(). The
129 // |event_router| argument can be NULL. 129 // |event_router| argument can be NULL.
130 static ProvidedFileSystemInterface* Create( 130 static ProvidedFileSystemInterface* Create(
131 Profile* profile, 131 Profile* profile,
132 const ProvidedFileSystemInfo& file_system_info); 132 const ProvidedFileSystemInfo& file_system_info);
133 133
134 private: 134 private:
135 typedef std::map<base::FilePath, FakeEntry> Entries; 135 typedef std::map<base::FilePath, FakeEntry> Entries;
136 typedef std::map<int, base::FilePath> OpenedFilesMap; 136 typedef std::map<int, base::FilePath> OpenedFilesMap;
137 137
138 // Utility function for posting a task which can be aborted by calling the 138 // Utility function for posting a task which can be aborted by calling the
139 // returned callback. 139 // returned callback.
140 AbortCallback PostAbortableTask(const base::Closure& callback); 140 AbortCallback PostAbortableTask(const base::Closure& callback);
141 141
142 // Aborts a request. |task_id| refers to a posted callback returning a 142 // Aborts a request. |task_id| refers to a posted callback returning a
143 // response for the operation, which will be cancelled, hence not called. 143 // response for the operation, which will be cancelled, hence not called.
144 void Abort(int task_id, 144 void Abort(int task_id,
145 const fileapi::AsyncFileUtil::StatusCallback& callback); 145 const storage::AsyncFileUtil::StatusCallback& callback);
146 146
147 // Aborts a request. |task_ids| refers to a vector of posted callbacks 147 // Aborts a request. |task_ids| refers to a vector of posted callbacks
148 // returning a response for the operation, which will be cancelled, hence not 148 // returning a response for the operation, which will be cancelled, hence not
149 // called. 149 // called.
150 void AbortMany(const std::vector<int>& task_ids, 150 void AbortMany(const std::vector<int>& task_ids,
151 const fileapi::AsyncFileUtil::StatusCallback& callback); 151 const storage::AsyncFileUtil::StatusCallback& callback);
152 152
153 ProvidedFileSystemInfo file_system_info_; 153 ProvidedFileSystemInfo file_system_info_;
154 Entries entries_; 154 Entries entries_;
155 OpenedFilesMap opened_files_; 155 OpenedFilesMap opened_files_;
156 int last_file_handle_; 156 int last_file_handle_;
157 base::CancelableTaskTracker tracker_; 157 base::CancelableTaskTracker tracker_;
158 158
159 base::WeakPtrFactory<FakeProvidedFileSystem> weak_ptr_factory_; 159 base::WeakPtrFactory<FakeProvidedFileSystem> weak_ptr_factory_;
160 DISALLOW_COPY_AND_ASSIGN(FakeProvidedFileSystem); 160 DISALLOW_COPY_AND_ASSIGN(FakeProvidedFileSystem);
161 }; 161 };
162 162
163 } // namespace file_system_provider 163 } // namespace file_system_provider
164 } // namespace chromeos 164 } // namespace chromeos
165 165
166 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FAKE_PROVIDED_FILE_SYSTE M_H_ 166 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FAKE_PROVIDED_FILE_SYSTE M_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698