| 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" |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 net::IOBuffer* buffer, | 135 net::IOBuffer* buffer, |
| 136 int64 offset, | 136 int64 offset, |
| 137 int length, | 137 int length, |
| 138 const storage::AsyncFileUtil::StatusCallback& callback) override; | 138 const storage::AsyncFileUtil::StatusCallback& callback) override; |
| 139 virtual AbortCallback ObserveDirectory( | 139 virtual AbortCallback ObserveDirectory( |
| 140 const base::FilePath& directory_path, | 140 const base::FilePath& directory_path, |
| 141 bool recursive, | 141 bool recursive, |
| 142 const storage::AsyncFileUtil::StatusCallback& callback) override; | 142 const storage::AsyncFileUtil::StatusCallback& callback) override; |
| 143 virtual void UnobserveEntry( | 143 virtual void UnobserveEntry( |
| 144 const base::FilePath& entry_path, | 144 const base::FilePath& entry_path, |
| 145 bool recursive, |
| 145 const storage::AsyncFileUtil::StatusCallback& callback) override; | 146 const storage::AsyncFileUtil::StatusCallback& callback) override; |
| 146 virtual const ProvidedFileSystemInfo& GetFileSystemInfo() const override; | 147 virtual const ProvidedFileSystemInfo& GetFileSystemInfo() const override; |
| 147 virtual RequestManager* GetRequestManager() override; | 148 virtual RequestManager* GetRequestManager() override; |
| 148 virtual ObservedEntries* GetObservedEntries() override; | 149 virtual ObservedEntries* GetObservedEntries() override; |
| 149 virtual void AddObserver(ProvidedFileSystemObserver* observer) override; | 150 virtual void AddObserver(ProvidedFileSystemObserver* observer) override; |
| 150 virtual void RemoveObserver(ProvidedFileSystemObserver* observer) override; | 151 virtual void RemoveObserver(ProvidedFileSystemObserver* observer) override; |
| 151 virtual bool Notify( | 152 virtual bool Notify(const base::FilePath& observed_path, |
| 152 const base::FilePath& observed_path, | 153 bool recursive, |
| 153 ProvidedFileSystemObserver::ChangeType change_type, | 154 ProvidedFileSystemObserver::ChangeType change_type, |
| 154 scoped_ptr<ProvidedFileSystemObserver::ChildChanges> child_changes, | 155 scoped_ptr<ProvidedFileSystemObserver::Changes> changes, |
| 155 const std::string& tag) override; | 156 const std::string& tag) override; |
| 156 virtual base::WeakPtr<ProvidedFileSystemInterface> GetWeakPtr() override; | 157 virtual base::WeakPtr<ProvidedFileSystemInterface> GetWeakPtr() override; |
| 157 | 158 |
| 158 private: | 159 private: |
| 159 // Aborts an operation executed with a request id equal to | 160 // Aborts an operation executed with a request id equal to |
| 160 // |operation_request_id|. The request is removed immediately on the C++ side | 161 // |operation_request_id|. The request is removed immediately on the C++ side |
| 161 // despite being handled by the providing extension or not. | 162 // despite being handled by the providing extension or not. |
| 162 void Abort(int operation_request_id, | 163 void Abort(int operation_request_id, |
| 163 const storage::AsyncFileUtil::StatusCallback& callback); | 164 const storage::AsyncFileUtil::StatusCallback& callback); |
| 164 | 165 |
| 165 // Called when a directory becomes watched successfully. | 166 // Called when a directory becomes watched successfully. |
| 166 void OnObserveDirectoryCompleted( | 167 void OnObserveDirectoryCompleted( |
| 167 const base::FilePath& directory_path, | 168 const base::FilePath& directory_path, |
| 168 bool recursive, | 169 bool recursive, |
| 169 const storage::AsyncFileUtil::StatusCallback& callback, | 170 const storage::AsyncFileUtil::StatusCallback& callback, |
| 170 base::File::Error result); | 171 base::File::Error result); |
| 171 | 172 |
| 172 // Called when all observers finished handling the change notification. It | 173 // 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|. | 174 // updates the tag from |last_tag| to |tag| for the entry at |observed_path|. |
| 174 void OnNotifyCompleted( | 175 void OnNotifyCompleted( |
| 175 const base::FilePath& observed_path, | 176 const base::FilePath& observed_path, |
| 177 bool recursive, |
| 176 ProvidedFileSystemObserver::ChangeType change_type, | 178 ProvidedFileSystemObserver::ChangeType change_type, |
| 177 scoped_ptr<ProvidedFileSystemObserver::ChildChanges> child_changes, | 179 scoped_ptr<ProvidedFileSystemObserver::Changes> changes, |
| 178 const std::string& last_tag, | 180 const std::string& last_tag, |
| 179 const std::string& tag); | 181 const std::string& tag); |
| 180 | 182 |
| 181 Profile* profile_; // Not owned. | 183 Profile* profile_; // Not owned. |
| 182 extensions::EventRouter* event_router_; // Not owned. May be NULL. | 184 extensions::EventRouter* event_router_; // Not owned. May be NULL. |
| 183 ProvidedFileSystemInfo file_system_info_; | 185 ProvidedFileSystemInfo file_system_info_; |
| 184 scoped_ptr<NotificationManagerInterface> notification_manager_; | 186 scoped_ptr<NotificationManagerInterface> notification_manager_; |
| 185 scoped_ptr<RequestManager> request_manager_; | 187 scoped_ptr<RequestManager> request_manager_; |
| 186 ObservedEntries observed_entries_; | 188 ObservedEntries observed_entries_; |
| 187 ObserverList<ProvidedFileSystemObserver> observers_; | 189 ObserverList<ProvidedFileSystemObserver> observers_; |
| 188 | 190 |
| 189 base::WeakPtrFactory<ProvidedFileSystem> weak_ptr_factory_; | 191 base::WeakPtrFactory<ProvidedFileSystem> weak_ptr_factory_; |
| 190 DISALLOW_COPY_AND_ASSIGN(ProvidedFileSystem); | 192 DISALLOW_COPY_AND_ASSIGN(ProvidedFileSystem); |
| 191 }; | 193 }; |
| 192 | 194 |
| 193 } // namespace file_system_provider | 195 } // namespace file_system_provider |
| 194 } // namespace chromeos | 196 } // namespace chromeos |
| 195 | 197 |
| 196 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_H_ | 198 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_H_ |
| OLD | NEW |