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

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

Issue 1093383002: [WIP] Provided file system from NACL. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved several modules to chromeos folder. Created 5 years, 5 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_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 13 matching lines...) Expand all
24 class Profile; 24 class Profile;
25 25
26 namespace net { 26 namespace net {
27 class IOBuffer; 27 class IOBuffer;
28 } // namespace net 28 } // namespace net
29 29
30 namespace base { 30 namespace base {
31 class FilePath; 31 class FilePath;
32 } // namespace base 32 } // namespace base
33 33
34 namespace extensions {
35 class EventRouter;
36 } // namespace extensions
37
38 namespace chromeos { 34 namespace chromeos {
39 namespace file_system_provider { 35 namespace file_system_provider {
40 36
41 class NotificationManagerInterface; 37 class NotificationManagerInterface;
42 38
43 // Automatically calls the |update_callback| after all of the callbacks created 39 // Automatically calls the |update_callback| after all of the callbacks created
44 // with |CreateCallback| are called. 40 // with |CreateCallback| are called.
45 // 41 //
46 // It's used to update tags of watchers once a notification about a change is 42 // It's used to update tags of watchers once a notification about a change is
47 // handled. It is to make sure that the change notification is fully handled 43 // handled. It is to make sure that the change notification is fully handled
(...skipping 18 matching lines...) Expand all
66 62
67 virtual ~AutoUpdater(); 63 virtual ~AutoUpdater();
68 64
69 base::Closure update_callback_; 65 base::Closure update_callback_;
70 int created_callbacks_; 66 int created_callbacks_;
71 int pending_callbacks_; 67 int pending_callbacks_;
72 }; 68 };
73 69
74 // Provided file system implementation. Forwards requests between providers and 70 // Provided file system implementation. Forwards requests between providers and
75 // clients. 71 // clients.
76 class ProvidedFileSystem : public ProvidedFileSystemInterface { 72 template <class DestinationPolicy>
73 class ProvidedFileSystem : public ProvidedFileSystemInterface,
74 public DestinationPolicy {
77 public: 75 public:
78 ProvidedFileSystem(Profile* profile, 76 ProvidedFileSystem(Profile* profile,
79 const ProvidedFileSystemInfo& file_system_info); 77 const ProvidedFileSystemInfo& file_system_info);
80 ~ProvidedFileSystem() override; 78 ~ProvidedFileSystem() override;
81 79
82 // Sets a custom event router. Used in unit tests to mock out the real 80 // Sets a custom event router. Used in unit tests to mock out the real
83 // extension. 81 // extension.
84 void SetEventRouterForTesting(extensions::EventRouter* event_router); 82 void SetEventRouterForTesting(
83 typename DestinationPolicy::EventRouterType* event_router);
85 84
86 // Sets a custom notification manager. It will recreate the request manager, 85 // Sets a custom notification manager. It will recreate the request manager,
87 // so is must be called just after creating ProvideFileSystem instance. 86 // so is must be called just after creating ProvideFileSystem instance.
88 // Used by unit tests. 87 // Used by unit tests.
89 void SetNotificationManagerForTesting( 88 void SetNotificationManagerForTesting(
90 scoped_ptr<NotificationManagerInterface> notification_manager); 89 scoped_ptr<NotificationManagerInterface> notification_manager);
91 90
92 // ProvidedFileSystemInterface overrides. 91 // ProvidedFileSystemInterface overrides.
93 AbortCallback RequestUnmount( 92 AbortCallback RequestUnmount(
94 const storage::AsyncFileUtil::StatusCallback& callback) override; 93 const storage::AsyncFileUtil::StatusCallback& callback) override;
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 const OpenFileCallback& callback, 224 const OpenFileCallback& callback,
226 int file_handle, 225 int file_handle,
227 base::File::Error result); 226 base::File::Error result);
228 227
229 // Called when closing a file is completed with either a success or an error. 228 // Called when closing a file is completed with either a success or an error.
230 void OnCloseFileCompleted( 229 void OnCloseFileCompleted(
231 int file_handle, 230 int file_handle,
232 const storage::AsyncFileUtil::StatusCallback& callback, 231 const storage::AsyncFileUtil::StatusCallback& callback,
233 base::File::Error result); 232 base::File::Error result);
234 233
235 Profile* profile_; // Not owned. 234 // Not owned.
236 extensions::EventRouter* event_router_; // Not owned. May be NULL. 235 Profile* profile_;
236 // Not owned. May be NULL
237 typename DestinationPolicy::EventRouterType* event_router_;
237 ProvidedFileSystemInfo file_system_info_; 238 ProvidedFileSystemInfo file_system_info_;
238 scoped_ptr<NotificationManagerInterface> notification_manager_; 239 scoped_ptr<NotificationManagerInterface> notification_manager_;
239 scoped_ptr<RequestManager> request_manager_; 240 scoped_ptr<RequestManager> request_manager_;
240 Watchers watchers_; 241 Watchers watchers_;
241 Queue watcher_queue_; 242 Queue watcher_queue_;
242 OpenedFiles opened_files_; 243 OpenedFiles opened_files_;
243 base::ObserverList<ProvidedFileSystemObserver> observers_; 244 base::ObserverList<ProvidedFileSystemObserver> observers_;
244 245
245 base::WeakPtrFactory<ProvidedFileSystem> weak_ptr_factory_; 246 base::WeakPtrFactory<ProvidedFileSystem<DestinationPolicy>> weak_ptr_factory_;
246 DISALLOW_COPY_AND_ASSIGN(ProvidedFileSystem); 247 DISALLOW_COPY_AND_ASSIGN(ProvidedFileSystem<DestinationPolicy>);
247 }; 248 };
248 249
249 } // namespace file_system_provider 250 } // namespace file_system_provider
250 } // namespace chromeos 251 } // namespace chromeos
251 252
252 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_H_ 253 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698