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 f5554bd4592fa0e5bff94e5fdce8f3b4aac1587c..d98276792617c458e134684df3c85fbab91a5229 100644 |
--- a/chrome/browser/chromeos/file_system_provider/service.h |
+++ b/chrome/browser/chromeos/file_system_provider/service.h |
@@ -7,6 +7,7 @@ |
#include <map> |
#include <string> |
+#include <utility> |
#include <vector> |
#include "base/files/file.h" |
@@ -55,19 +56,21 @@ class Service : public KeyedService, |
const FileSystemFactoryCallback& factory_callback); |
// Mounts a file system provided by an extension with the |extension_id|. |
- // For success, it returns a numeric file system id, which is an |
- // auto-incremented non-zero value. For failures, it returns zero. |
- int MountFileSystem(const std::string& extension_id, |
- const std::string& file_system_name); |
+ // For success, returns true, otherwise false. |
+ bool MountFileSystem(const std::string& extension_id, |
+ const std::string& file_system_id, |
+ const std::string& file_system_name); |
// Unmounts a file system with the specified |file_system_id| for the |
// |extension_id|. For success returns true, otherwise false. |
- bool UnmountFileSystem(const std::string& extension_id, int file_system_id); |
+ bool UnmountFileSystem(const std::string& extension_id, |
+ const std::string& 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(int file_system_id); |
+ bool RequestUnmount(const std::string& extension_id, |
+ const std::string& file_system_id); |
// Returns a list of information of all currently provided file systems. All |
// items are copied. |
@@ -77,7 +80,7 @@ class Service : public KeyedService, |
// the extension with |extension_id|. If not found, then returns NULL. |
ProvidedFileSystemInterface* GetProvidedFileSystem( |
const std::string& extension_id, |
- int file_system_id); |
+ const std::string& file_system_id); |
// Returns a provided file system attached to the the passed |
// |mount_point_name|. If not found, then returns NULL. |
@@ -98,8 +101,13 @@ class Service : public KeyedService, |
extensions::UnloadedExtensionInfo::Reason reason) OVERRIDE; |
private: |
- typedef std::map<int, ProvidedFileSystemInterface*> ProvidedFileSystemMap; |
- typedef std::map<std::string, int> MountPointNameToIdMap; |
+ // Key is a pair of an extension id and file system id, which makes it |
+ // unique among the entire service instance. |
+ typedef std::pair<std::string, std::string> FileSystemKey; |
+ |
+ typedef std::map<FileSystemKey, ProvidedFileSystemInterface*> |
+ ProvidedFileSystemMap; |
+ typedef std::map<std::string, FileSystemKey> MountPointNameToKeyMap; |
// Called when the providing extension accepts or refuses a unmount request. |
// If |error| is equal to FILE_OK, then the request is accepted. |
@@ -111,8 +119,7 @@ class Service : public KeyedService, |
FileSystemFactoryCallback file_system_factory_; |
ObserverList<Observer> observers_; |
ProvidedFileSystemMap file_system_map_; // Owns pointers. |
- MountPointNameToIdMap mount_point_name_to_id_map_; |
- int next_id_; |
+ MountPointNameToKeyMap mount_point_name_to_key_map_; |
base::WeakPtrFactory<Service> weak_ptr_factory_; |
DISALLOW_COPY_AND_ASSIGN(Service); |