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

Unified Diff: chrome/browser/chromeos/file_system_provider/service.h

Issue 210803003: [fsp] Decouple file_service_provider::Service. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/file_system_provider/service.h
diff --git a/chrome/browser/chromeos/file_system_provider/service.h b/chrome/browser/chromeos/file_system_provider/service.h
index 735e05fb9bf14f79a37f67a34639838da72c7a7e..a719c5cea74286688d47323978d51915bb476870 100644
--- a/chrome/browser/chromeos/file_system_provider/service.h
+++ b/chrome/browser/chromeos/file_system_provider/service.h
@@ -24,6 +24,8 @@
namespace chromeos {
namespace file_system_provider {
+class ProvidedFileSystemInfo;
+class ProvidedFileSystemInterface;
class ServiceFactory;
// Manages and registers the fileSystemProvider service.
@@ -42,29 +44,20 @@ class Service : public KeyedService {
// |extension_id|. For success returns true, otherwise false.
bool UnmountFileSystem(const std::string& extension_id, int file_system_id);
- // Returns a list of currently mounted file systems. All items are copied.
- std::vector<ProvidedFileSystem> GetMountedFileSystems();
-
- // Handles successful response for the |request_id|. If |has_next| is false,
- // then the request is disposed, after handling the |response|. On error,
- // returns false, and the request is disposed.
- bool FulfillRequest(const std::string& extension_id,
- int file_system_id,
- int request_id,
- scoped_ptr<base::DictionaryValue> result,
- bool has_next);
-
- // Handles error response for the |request_id|. If handling the error fails,
- // returns false. Always disposes the request.
- bool RejectRequest(const std::string& extension_id,
- int file_system_id,
- int request_id,
- base::File::Error error);
-
- // Requests unmounting of a file system with the passed |file_system_id|.
- // Returns true is unmounting has been requested. False, if the request is
- // invalid (eg. already unmounted).
- bool RequestUnmount(int file_system_id);
+ // Requests unmounting of the file system. The callback is called when the
+ // request is accepted or rejected, with an error code. Returns false if the
+ // request could not been created, true otherwise.
+ bool RequestUnmount(const std::string& extension_id, int file_system_id);
+
+ // Returns a list of information of all currently provided file systems. All
+ // items are copied.
+ std::vector<ProvidedFileSystemInfo> GetProvidedFileSystemInfoList();
+
+ // Returns a provided file system with |file_system_id|, handled by
+ // the extension with |extension_id|. If not found, then returns NULL.
+ ProvidedFileSystemInterface* GetProvidedFileSystem(
+ const std::string& extension_id,
+ int file_system_id);
// Adds and removes observers.
void AddObserver(Observer* observer);
@@ -76,18 +69,26 @@ class Service : public KeyedService {
// BrowserContextKeyedService overrides.
virtual void Shutdown() OVERRIDE;
+ // Getter for the request manager. Used by the extension API to forward
+ // replies. Valid as long as the service.
+ RequestManager* request_manager() { return &request_manager_; }
+
private:
- typedef std::map<int, ProvidedFileSystem> FileSystemMap;
+ typedef std::map<int, ProvidedFileSystemInterface*> ProvidedFileSystemMap;
- // Called when the providing extension calls the success callback for the
- // onUnmountRequested event.
- void OnRequestUnmountError(const ProvidedFileSystem& file_system,
- base::File::Error error);
+ // Called when the providing extension accepts or refuses a unmount request.
+ // If |error| is equal to FILE_OK, then the request is accepted.
+ void OnRequestUnmountStatus(const ProvidedFileSystemInfo& file_system_info,
+ base::File::Error error);
RequestManager request_manager_;
Profile* profile_;
ObserverList<Observer> observers_;
- FileSystemMap file_systems_;
+ ScopedVector<ProvidedFileSystemInterface> file_systems_;
+
+ // Values owned by above ScopedVector.
hashimoto 2014/03/26 03:03:01 Managing two containers is difficult. How about ow
mtomasz 2014/03/26 05:45:13 Good point. Done.
+ ProvidedFileSystemMap file_system_map_;
+
int next_id_;
base::WeakPtrFactory<Service> weak_ptr_factory_;

Powered by Google App Engine
This is Rietveld 408576698