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