| 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 "storage/browser/fileapi/watcher_manager.h" |
| 19 #include "url/gurl.h" | 20 #include "url/gurl.h" |
| 20 | 21 |
| 21 class Profile; | 22 class Profile; |
| 22 | 23 |
| 23 namespace net { | 24 namespace net { |
| 24 class IOBuffer; | 25 class IOBuffer; |
| 25 } // namespace net | 26 } // namespace net |
| 26 | 27 |
| 27 namespace base { | 28 namespace base { |
| 28 class FilePath; | 29 class FilePath; |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 int file_handle, | 136 int file_handle, |
| 136 net::IOBuffer* buffer, | 137 net::IOBuffer* buffer, |
| 137 int64 offset, | 138 int64 offset, |
| 138 int length, | 139 int length, |
| 139 const storage::AsyncFileUtil::StatusCallback& callback) override; | 140 const storage::AsyncFileUtil::StatusCallback& callback) override; |
| 140 virtual AbortCallback AddWatcher( | 141 virtual AbortCallback AddWatcher( |
| 141 const GURL& origin, | 142 const GURL& origin, |
| 142 const base::FilePath& entry_path, | 143 const base::FilePath& entry_path, |
| 143 bool recursive, | 144 bool recursive, |
| 144 bool persistent, | 145 bool persistent, |
| 145 const storage::AsyncFileUtil::StatusCallback& callback) override; | 146 const storage::AsyncFileUtil::StatusCallback& callback, |
| 147 const storage::WatcherManager::NotificationCallback& |
| 148 notification_callback) override; |
| 146 virtual void RemoveWatcher( | 149 virtual void RemoveWatcher( |
| 147 const GURL& origin, | 150 const GURL& origin, |
| 148 const base::FilePath& entry_path, | 151 const base::FilePath& entry_path, |
| 149 bool recursive, | 152 bool recursive, |
| 150 const storage::AsyncFileUtil::StatusCallback& callback) override; | 153 const storage::AsyncFileUtil::StatusCallback& callback) override; |
| 151 virtual const ProvidedFileSystemInfo& GetFileSystemInfo() const override; | 154 virtual const ProvidedFileSystemInfo& GetFileSystemInfo() const override; |
| 152 virtual RequestManager* GetRequestManager() override; | 155 virtual RequestManager* GetRequestManager() override; |
| 153 virtual Watchers* GetWatchers() override; | 156 virtual Watchers* GetWatchers() override; |
| 154 virtual void AddObserver(ProvidedFileSystemObserver* observer) override; | 157 virtual void AddObserver(ProvidedFileSystemObserver* observer) override; |
| 155 virtual void RemoveObserver(ProvidedFileSystemObserver* observer) override; | 158 virtual void RemoveObserver(ProvidedFileSystemObserver* observer) override; |
| 156 virtual bool Notify(const base::FilePath& entry_path, | 159 virtual bool Notify(const base::FilePath& entry_path, |
| 157 bool recursive, | 160 bool recursive, |
| 158 ProvidedFileSystemObserver::ChangeType change_type, | 161 storage::WatcherManager::ChangeType change_type, |
| 159 scoped_ptr<ProvidedFileSystemObserver::Changes> changes, | 162 scoped_ptr<ProvidedFileSystemObserver::Changes> changes, |
| 160 const std::string& tag) override; | 163 const std::string& tag) override; |
| 161 virtual base::WeakPtr<ProvidedFileSystemInterface> GetWeakPtr() override; | 164 virtual base::WeakPtr<ProvidedFileSystemInterface> GetWeakPtr() override; |
| 162 | 165 |
| 163 private: | 166 private: |
| 164 // Aborts an operation executed with a request id equal to | 167 // Aborts an operation executed with a request id equal to |
| 165 // |operation_request_id|. The request is removed immediately on the C++ side | 168 // |operation_request_id|. The request is removed immediately on the C++ side |
| 166 // despite being handled by the providing extension or not. | 169 // despite being handled by the providing extension or not. |
| 167 void Abort(int operation_request_id, | 170 void Abort(int operation_request_id, |
| 168 const storage::AsyncFileUtil::StatusCallback& callback); | 171 const storage::AsyncFileUtil::StatusCallback& callback); |
| 169 | 172 |
| 170 // Called when adding a watcher is completed with either success or en error. | 173 // Called when adding a watcher is completed with either success or en error. |
| 171 void OnAddWatcherCompleted( | 174 void OnAddWatcherCompleted( |
| 172 const GURL& origin, | |
| 173 const base::FilePath& entry_path, | 175 const base::FilePath& entry_path, |
| 174 bool recursive, | 176 bool recursive, |
| 175 bool persistent, | 177 const Subscriber& subscriber, |
| 176 const storage::AsyncFileUtil::StatusCallback& callback, | 178 const storage::AsyncFileUtil::StatusCallback& callback, |
| 177 base::File::Error result); | 179 base::File::Error result); |
| 178 | 180 |
| 179 // Called when all observers finished handling the change notification. It | 181 // Called when all observers finished handling the change notification. It |
| 180 // updates the tag from |last_tag| to |tag| for the entry at |entry_path|. | 182 // updates the tag from |last_tag| to |tag| for the entry at |entry_path|. |
| 181 void OnNotifyCompleted( | 183 void OnNotifyCompleted( |
| 182 const base::FilePath& entry_path, | 184 const base::FilePath& entry_path, |
| 183 bool recursive, | 185 bool recursive, |
| 184 ProvidedFileSystemObserver::ChangeType change_type, | 186 storage::WatcherManager::ChangeType change_type, |
| 185 scoped_ptr<ProvidedFileSystemObserver::Changes> changes, | 187 scoped_ptr<ProvidedFileSystemObserver::Changes> changes, |
| 186 const std::string& last_tag, | 188 const std::string& last_tag, |
| 187 const std::string& tag); | 189 const std::string& tag); |
| 188 | 190 |
| 189 Profile* profile_; // Not owned. | 191 Profile* profile_; // Not owned. |
| 190 extensions::EventRouter* event_router_; // Not owned. May be NULL. | 192 extensions::EventRouter* event_router_; // Not owned. May be NULL. |
| 191 ProvidedFileSystemInfo file_system_info_; | 193 ProvidedFileSystemInfo file_system_info_; |
| 192 scoped_ptr<NotificationManagerInterface> notification_manager_; | 194 scoped_ptr<NotificationManagerInterface> notification_manager_; |
| 193 scoped_ptr<RequestManager> request_manager_; | 195 scoped_ptr<RequestManager> request_manager_; |
| 194 Watchers watchers_; | 196 Watchers watchers_; |
| 195 ObserverList<ProvidedFileSystemObserver> observers_; | 197 ObserverList<ProvidedFileSystemObserver> observers_; |
| 196 | 198 |
| 197 base::WeakPtrFactory<ProvidedFileSystem> weak_ptr_factory_; | 199 base::WeakPtrFactory<ProvidedFileSystem> weak_ptr_factory_; |
| 198 DISALLOW_COPY_AND_ASSIGN(ProvidedFileSystem); | 200 DISALLOW_COPY_AND_ASSIGN(ProvidedFileSystem); |
| 199 }; | 201 }; |
| 200 | 202 |
| 201 } // namespace file_system_provider | 203 } // namespace file_system_provider |
| 202 } // namespace chromeos | 204 } // namespace chromeos |
| 203 | 205 |
| 204 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_H_ | 206 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_H_ |
| OLD | NEW |