OLD | NEW |
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> |
11 | 11 |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/memory/linked_ptr.h" | 13 #include "base/memory/linked_ptr.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "base/observer_list.h" |
15 #include "base/task/cancelable_task_tracker.h" | 16 #include "base/task/cancelable_task_tracker.h" |
16 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_info
.h" | 17 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_info
.h" |
17 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_inte
rface.h" | 18 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_inte
rface.h" |
18 | 19 |
19 class Profile; | 20 class Profile; |
20 | 21 |
21 namespace base { | 22 namespace base { |
22 class Time; | 23 class Time; |
23 } // namespace base | 24 } // namespace base |
24 | 25 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 int64 length, | 118 int64 length, |
118 const storage::AsyncFileUtil::StatusCallback& callback) OVERRIDE; | 119 const storage::AsyncFileUtil::StatusCallback& callback) OVERRIDE; |
119 virtual AbortCallback WriteFile( | 120 virtual AbortCallback WriteFile( |
120 int file_handle, | 121 int file_handle, |
121 net::IOBuffer* buffer, | 122 net::IOBuffer* buffer, |
122 int64 offset, | 123 int64 offset, |
123 int length, | 124 int length, |
124 const storage::AsyncFileUtil::StatusCallback& callback) OVERRIDE; | 125 const storage::AsyncFileUtil::StatusCallback& callback) OVERRIDE; |
125 virtual const ProvidedFileSystemInfo& GetFileSystemInfo() const OVERRIDE; | 126 virtual const ProvidedFileSystemInfo& GetFileSystemInfo() const OVERRIDE; |
126 virtual RequestManager* GetRequestManager() OVERRIDE; | 127 virtual RequestManager* GetRequestManager() OVERRIDE; |
| 128 virtual ObservedEntries* GetObservedEntries() OVERRIDE; |
| 129 virtual void AddObserver(Observer* observer) OVERRIDE; |
| 130 virtual void RemoveObserver(Observer* observer) OVERRIDE; |
| 131 virtual ObserverList<Observer>* GetObservers() OVERRIDE; |
127 virtual base::WeakPtr<ProvidedFileSystemInterface> GetWeakPtr() OVERRIDE; | 132 virtual base::WeakPtr<ProvidedFileSystemInterface> GetWeakPtr() OVERRIDE; |
128 | 133 |
129 // Factory callback, to be used in Service::SetFileSystemFactory(). The | 134 // Factory callback, to be used in Service::SetFileSystemFactory(). The |
130 // |event_router| argument can be NULL. | 135 // |event_router| argument can be NULL. |
131 static ProvidedFileSystemInterface* Create( | 136 static ProvidedFileSystemInterface* Create( |
132 Profile* profile, | 137 Profile* profile, |
133 const ProvidedFileSystemInfo& file_system_info); | 138 const ProvidedFileSystemInfo& file_system_info); |
134 | 139 |
135 private: | 140 private: |
136 typedef std::map<base::FilePath, linked_ptr<FakeEntry> > Entries; | 141 typedef std::map<base::FilePath, linked_ptr<FakeEntry> > Entries; |
(...skipping 12 matching lines...) Expand all Loading... |
149 // returning a response for the operation, which will be cancelled, hence not | 154 // returning a response for the operation, which will be cancelled, hence not |
150 // called. | 155 // called. |
151 void AbortMany(const std::vector<int>& task_ids, | 156 void AbortMany(const std::vector<int>& task_ids, |
152 const storage::AsyncFileUtil::StatusCallback& callback); | 157 const storage::AsyncFileUtil::StatusCallback& callback); |
153 | 158 |
154 ProvidedFileSystemInfo file_system_info_; | 159 ProvidedFileSystemInfo file_system_info_; |
155 Entries entries_; | 160 Entries entries_; |
156 OpenedFilesMap opened_files_; | 161 OpenedFilesMap opened_files_; |
157 int last_file_handle_; | 162 int last_file_handle_; |
158 base::CancelableTaskTracker tracker_; | 163 base::CancelableTaskTracker tracker_; |
| 164 ObserverList<Observer> observers_; |
159 | 165 |
160 base::WeakPtrFactory<FakeProvidedFileSystem> weak_ptr_factory_; | 166 base::WeakPtrFactory<FakeProvidedFileSystem> weak_ptr_factory_; |
161 DISALLOW_COPY_AND_ASSIGN(FakeProvidedFileSystem); | 167 DISALLOW_COPY_AND_ASSIGN(FakeProvidedFileSystem); |
162 }; | 168 }; |
163 | 169 |
164 } // namespace file_system_provider | 170 } // namespace file_system_provider |
165 } // namespace chromeos | 171 } // namespace chromeos |
166 | 172 |
167 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FAKE_PROVIDED_FILE_SYSTE
M_H_ | 173 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FAKE_PROVIDED_FILE_SYSTE
M_H_ |
OLD | NEW |