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_PROVIDED_FILE_SYSTEM_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_H_ |
6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_H_ | 6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
14 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_info
.h" | 14 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_info
.h" |
15 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_inte
rface.h" | 15 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_inte
rface.h" |
16 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_obse
rver.h" | 16 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_obse
rver.h" |
17 #include "chrome/browser/chromeos/file_system_provider/request_manager.h" | 17 #include "chrome/browser/chromeos/file_system_provider/request_manager.h" |
18 #include "storage/browser/fileapi/async_file_util.h" | 18 #include "storage/browser/fileapi/async_file_util.h" |
| 19 #include "url/gurl.h" |
19 | 20 |
20 class Profile; | 21 class Profile; |
21 | 22 |
22 namespace net { | 23 namespace net { |
23 class IOBuffer; | 24 class IOBuffer; |
24 } // namespace net | 25 } // namespace net |
25 | 26 |
26 namespace base { | 27 namespace base { |
27 class FilePath; | 28 class FilePath; |
28 } // namespace base | 29 } // namespace base |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 const base::FilePath& file_path, | 131 const base::FilePath& file_path, |
131 int64 length, | 132 int64 length, |
132 const storage::AsyncFileUtil::StatusCallback& callback) override; | 133 const storage::AsyncFileUtil::StatusCallback& callback) override; |
133 virtual AbortCallback WriteFile( | 134 virtual AbortCallback WriteFile( |
134 int file_handle, | 135 int file_handle, |
135 net::IOBuffer* buffer, | 136 net::IOBuffer* buffer, |
136 int64 offset, | 137 int64 offset, |
137 int length, | 138 int length, |
138 const storage::AsyncFileUtil::StatusCallback& callback) override; | 139 const storage::AsyncFileUtil::StatusCallback& callback) override; |
139 virtual AbortCallback ObserveDirectory( | 140 virtual AbortCallback ObserveDirectory( |
| 141 const GURL& origin, |
140 const base::FilePath& directory_path, | 142 const base::FilePath& directory_path, |
141 bool recursive, | 143 bool recursive, |
| 144 bool persistent, |
142 const storage::AsyncFileUtil::StatusCallback& callback) override; | 145 const storage::AsyncFileUtil::StatusCallback& callback) override; |
143 virtual void UnobserveEntry( | 146 virtual void UnobserveEntry( |
| 147 const GURL& origin, |
144 const base::FilePath& entry_path, | 148 const base::FilePath& entry_path, |
145 const storage::AsyncFileUtil::StatusCallback& callback) override; | 149 const storage::AsyncFileUtil::StatusCallback& callback) override; |
146 virtual const ProvidedFileSystemInfo& GetFileSystemInfo() const override; | 150 virtual const ProvidedFileSystemInfo& GetFileSystemInfo() const override; |
147 virtual RequestManager* GetRequestManager() override; | 151 virtual RequestManager* GetRequestManager() override; |
148 virtual ObservedEntries* GetObservedEntries() override; | 152 virtual ObservedEntries* GetObservedEntries() override; |
149 virtual void AddObserver(ProvidedFileSystemObserver* observer) override; | 153 virtual void AddObserver(ProvidedFileSystemObserver* observer) override; |
150 virtual void RemoveObserver(ProvidedFileSystemObserver* observer) override; | 154 virtual void RemoveObserver(ProvidedFileSystemObserver* observer) override; |
151 virtual bool Notify( | 155 virtual bool Notify( |
152 const base::FilePath& observed_path, | 156 const base::FilePath& observed_path, |
153 ProvidedFileSystemObserver::ChangeType change_type, | 157 ProvidedFileSystemObserver::ChangeType change_type, |
154 scoped_ptr<ProvidedFileSystemObserver::ChildChanges> child_changes, | 158 scoped_ptr<ProvidedFileSystemObserver::ChildChanges> child_changes, |
155 const std::string& tag) override; | 159 const std::string& tag) override; |
156 virtual base::WeakPtr<ProvidedFileSystemInterface> GetWeakPtr() override; | 160 virtual base::WeakPtr<ProvidedFileSystemInterface> GetWeakPtr() override; |
157 | 161 |
158 private: | 162 private: |
159 // Aborts an operation executed with a request id equal to | 163 // Aborts an operation executed with a request id equal to |
160 // |operation_request_id|. The request is removed immediately on the C++ side | 164 // |operation_request_id|. The request is removed immediately on the C++ side |
161 // despite being handled by the providing extension or not. | 165 // despite being handled by the providing extension or not. |
162 void Abort(int operation_request_id, | 166 void Abort(int operation_request_id, |
163 const storage::AsyncFileUtil::StatusCallback& callback); | 167 const storage::AsyncFileUtil::StatusCallback& callback); |
164 | 168 |
165 // Called when a directory becomes watched successfully. | 169 // Called when observing a directory process is completed with either success |
| 170 // or en error. |
166 void OnObserveDirectoryCompleted( | 171 void OnObserveDirectoryCompleted( |
| 172 const GURL& origin, |
167 const base::FilePath& directory_path, | 173 const base::FilePath& directory_path, |
168 bool recursive, | 174 bool recursive, |
| 175 bool persistent, |
169 const storage::AsyncFileUtil::StatusCallback& callback, | 176 const storage::AsyncFileUtil::StatusCallback& callback, |
170 base::File::Error result); | 177 base::File::Error result); |
171 | 178 |
172 // Called when all observers finished handling the change notification. It | 179 // Called when all observers finished handling the change notification. It |
173 // updates the tag from |last_tag| to |tag| for the entry at |observed_path|. | 180 // updates the tag from |last_tag| to |tag| for the entry at |observed_path|. |
174 void OnNotifyCompleted( | 181 void OnNotifyCompleted( |
175 const base::FilePath& observed_path, | 182 const base::FilePath& observed_path, |
176 ProvidedFileSystemObserver::ChangeType change_type, | 183 ProvidedFileSystemObserver::ChangeType change_type, |
177 scoped_ptr<ProvidedFileSystemObserver::ChildChanges> child_changes, | 184 scoped_ptr<ProvidedFileSystemObserver::ChildChanges> child_changes, |
178 const std::string& last_tag, | 185 const std::string& last_tag, |
179 const std::string& tag); | 186 const std::string& tag); |
180 | 187 |
181 Profile* profile_; // Not owned. | 188 Profile* profile_; // Not owned. |
182 extensions::EventRouter* event_router_; // Not owned. May be NULL. | 189 extensions::EventRouter* event_router_; // Not owned. May be NULL. |
183 ProvidedFileSystemInfo file_system_info_; | 190 ProvidedFileSystemInfo file_system_info_; |
184 scoped_ptr<NotificationManagerInterface> notification_manager_; | 191 scoped_ptr<NotificationManagerInterface> notification_manager_; |
185 scoped_ptr<RequestManager> request_manager_; | 192 scoped_ptr<RequestManager> request_manager_; |
186 ObservedEntries observed_entries_; | 193 ObservedEntries observed_entries_; |
187 ObserverList<ProvidedFileSystemObserver> observers_; | 194 ObserverList<ProvidedFileSystemObserver> observers_; |
188 | 195 |
189 base::WeakPtrFactory<ProvidedFileSystem> weak_ptr_factory_; | 196 base::WeakPtrFactory<ProvidedFileSystem> weak_ptr_factory_; |
190 DISALLOW_COPY_AND_ASSIGN(ProvidedFileSystem); | 197 DISALLOW_COPY_AND_ASSIGN(ProvidedFileSystem); |
191 }; | 198 }; |
192 | 199 |
193 } // namespace file_system_provider | 200 } // namespace file_system_provider |
194 } // namespace chromeos | 201 } // namespace chromeos |
195 | 202 |
196 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_H_ | 203 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_H_ |
OLD | NEW |