Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(388)

Side by Side Diff: chrome/browser/chromeos/file_system_provider/fake_provided_file_system.h

Issue 625463002: [fsp] Add support for observing entries and notifying about changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
19 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_obse rver.h"
18 20
19 class Profile; 21 class Profile;
20 22
21 namespace base { 23 namespace base {
22 class Time; 24 class Time;
23 } // namespace base 25 } // namespace base
24 26
25 namespace net { 27 namespace net {
26 class IOBuffer; 28 class IOBuffer;
27 } // namespace net 29 } // namespace net
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 virtual AbortCallback Truncate( 117 virtual AbortCallback Truncate(
116 const base::FilePath& file_path, 118 const base::FilePath& file_path,
117 int64 length, 119 int64 length,
118 const storage::AsyncFileUtil::StatusCallback& callback) override; 120 const storage::AsyncFileUtil::StatusCallback& callback) override;
119 virtual AbortCallback WriteFile( 121 virtual AbortCallback WriteFile(
120 int file_handle, 122 int file_handle,
121 net::IOBuffer* buffer, 123 net::IOBuffer* buffer,
122 int64 offset, 124 int64 offset,
123 int length, 125 int length,
124 const storage::AsyncFileUtil::StatusCallback& callback) override; 126 const storage::AsyncFileUtil::StatusCallback& callback) override;
127 virtual AbortCallback ObserveDirectory(
128 const base::FilePath& directory_path,
129 bool recursive,
130 const storage::AsyncFileUtil::StatusCallback& callback) override;
131 virtual void UnobserveEntry(
132 const base::FilePath& entry_path,
133 const storage::AsyncFileUtil::StatusCallback& callback) override;
125 virtual const ProvidedFileSystemInfo& GetFileSystemInfo() const override; 134 virtual const ProvidedFileSystemInfo& GetFileSystemInfo() const override;
126 virtual RequestManager* GetRequestManager() override; 135 virtual RequestManager* GetRequestManager() override;
136 virtual ObservedEntries* GetObservedEntries() override;
137 virtual void AddObserver(ProvidedFileSystemObserver* observer) override;
138 virtual void RemoveObserver(ProvidedFileSystemObserver* observer) override;
139 virtual bool Notify(
140 const base::FilePath& observed_path,
141 ProvidedFileSystemObserver::ChangeType change_type,
142 const ProvidedFileSystemObserver::ChildChanges& child_changes,
143 const std::string& tag) override;
127 virtual base::WeakPtr<ProvidedFileSystemInterface> GetWeakPtr() override; 144 virtual base::WeakPtr<ProvidedFileSystemInterface> GetWeakPtr() override;
128 145
129 // Factory callback, to be used in Service::SetFileSystemFactory(). The 146 // Factory callback, to be used in Service::SetFileSystemFactory(). The
130 // |event_router| argument can be NULL. 147 // |event_router| argument can be NULL.
131 static ProvidedFileSystemInterface* Create( 148 static ProvidedFileSystemInterface* Create(
132 Profile* profile, 149 Profile* profile,
133 const ProvidedFileSystemInfo& file_system_info); 150 const ProvidedFileSystemInfo& file_system_info);
134 151
135 private: 152 private:
136 typedef std::map<base::FilePath, linked_ptr<FakeEntry> > Entries; 153 typedef std::map<base::FilePath, linked_ptr<FakeEntry> > Entries;
(...skipping 12 matching lines...) Expand all
149 // returning a response for the operation, which will be cancelled, hence not 166 // returning a response for the operation, which will be cancelled, hence not
150 // called. 167 // called.
151 void AbortMany(const std::vector<int>& task_ids, 168 void AbortMany(const std::vector<int>& task_ids,
152 const storage::AsyncFileUtil::StatusCallback& callback); 169 const storage::AsyncFileUtil::StatusCallback& callback);
153 170
154 ProvidedFileSystemInfo file_system_info_; 171 ProvidedFileSystemInfo file_system_info_;
155 Entries entries_; 172 Entries entries_;
156 OpenedFilesMap opened_files_; 173 OpenedFilesMap opened_files_;
157 int last_file_handle_; 174 int last_file_handle_;
158 base::CancelableTaskTracker tracker_; 175 base::CancelableTaskTracker tracker_;
176 ObserverList<ProvidedFileSystemObserver> observers_;
159 177
160 base::WeakPtrFactory<FakeProvidedFileSystem> weak_ptr_factory_; 178 base::WeakPtrFactory<FakeProvidedFileSystem> weak_ptr_factory_;
161 DISALLOW_COPY_AND_ASSIGN(FakeProvidedFileSystem); 179 DISALLOW_COPY_AND_ASSIGN(FakeProvidedFileSystem);
162 }; 180 };
163 181
164 } // namespace file_system_provider 182 } // namespace file_system_provider
165 } // namespace chromeos 183 } // namespace chromeos
166 184
167 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FAKE_PROVIDED_FILE_SYSTE M_H_ 185 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FAKE_PROVIDED_FILE_SYSTE M_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698