| Index: trunk/src/chrome/browser/chromeos/file_system_provider/service.cc
|
| ===================================================================
|
| --- trunk/src/chrome/browser/chromeos/file_system_provider/service.cc (revision 264799)
|
| +++ trunk/src/chrome/browser/chromeos/file_system_provider/service.cc (working copy)
|
| @@ -40,20 +40,8 @@
|
| next_id_(1),
|
| weak_ptr_factory_(this) {}
|
|
|
| -Service::~Service() {
|
| - ProvidedFileSystemMap::iterator it = file_system_map_.begin();
|
| - while (it != file_system_map_.end()) {
|
| - const int file_system_id = it->first;
|
| - const std::string extension_id =
|
| - it->second->GetFileSystemInfo().extension_id();
|
| - ++it;
|
| - UnmountFileSystem(extension_id, file_system_id);
|
| - }
|
| +Service::~Service() { STLDeleteValues(&file_system_map_); }
|
|
|
| - DCHECK_EQ(0u, file_system_map_.size());
|
| - STLDeleteValues(&file_system_map_);
|
| -}
|
| -
|
| // static
|
| Service* Service::Get(content::BrowserContext* context) {
|
| return ServiceFactory::Get(context);
|
| @@ -98,14 +86,15 @@
|
|
|
| // The mount point path and name are unique per system, since they are system
|
| // wide. This is necessary for copying between profiles.
|
| - const base::FilePath& mount_path =
|
| - util::GetMountPath(profile_, extension_id, file_system_id);
|
| - const std::string mount_point_name = mount_path.BaseName().AsUTF8Unsafe();
|
| + const base::FilePath& mount_point_path =
|
| + util::GetMountPointPath(profile_, extension_id, file_system_id);
|
| + const std::string mount_point_name =
|
| + mount_point_path.BaseName().AsUTF8Unsafe();
|
|
|
| if (!mount_points->RegisterFileSystem(mount_point_name,
|
| fileapi::kFileSystemTypeProvided,
|
| fileapi::FileSystemMountOption(),
|
| - mount_path)) {
|
| + mount_point_path)) {
|
| FOR_EACH_OBSERVER(
|
| Observer,
|
| observers_,
|
| @@ -118,10 +107,10 @@
|
| // system provider file system id.
|
| // Examples:
|
| // file_system_id = 41
|
| - // mount_point_name = b33f1337-41-5aa5
|
| - // mount_path = /provided/b33f1337-41-5aa5
|
| + // mount_point_name = file_system_id = b33f1337-41-5aa5
|
| + // mount_point_path = /provided/b33f1337-41-5aa5
|
| ProvidedFileSystemInfo file_system_info(
|
| - extension_id, file_system_id, file_system_name, mount_path);
|
| + extension_id, file_system_id, file_system_name, mount_point_path);
|
|
|
| // The event router may be NULL for unit tests.
|
| extensions::EventRouter* router = extensions::EventRouter::Get(profile_);
|
| @@ -130,7 +119,6 @@
|
| file_system_factory_.Run(router, file_system_info);
|
| DCHECK(file_system);
|
| file_system_map_[file_system_id] = file_system;
|
| - mount_point_name_to_id_map_[mount_point_name] = file_system_id;
|
|
|
| FOR_EACH_OBSERVER(
|
| Observer,
|
| @@ -145,7 +133,7 @@
|
| int file_system_id) {
|
| DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
|
|
|
| - const ProvidedFileSystemMap::iterator file_system_it =
|
| + ProvidedFileSystemMap::iterator file_system_it =
|
| file_system_map_.find(file_system_id);
|
| if (file_system_it == file_system_map_.end() ||
|
| file_system_it->second->GetFileSystemInfo().extension_id() !=
|
| @@ -182,11 +170,8 @@
|
| observers_,
|
| OnProvidedFileSystemUnmount(file_system_info, base::File::FILE_OK));
|
|
|
| - mount_point_name_to_id_map_.erase(mount_point_name);
|
| -
|
| delete file_system_it->second;
|
| file_system_map_.erase(file_system_it);
|
| -
|
| return true;
|
| }
|
|
|
| @@ -221,7 +206,7 @@
|
| int file_system_id) {
|
| DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
|
|
|
| - const ProvidedFileSystemMap::const_iterator file_system_it =
|
| + ProvidedFileSystemMap::iterator file_system_it =
|
| file_system_map_.find(file_system_id);
|
| if (file_system_it == file_system_map_.end() ||
|
| file_system_it->second->GetFileSystemInfo().extension_id() !=
|
| @@ -232,23 +217,6 @@
|
| return file_system_it->second;
|
| }
|
|
|
| -ProvidedFileSystemInterface* Service::GetProvidedFileSystem(
|
| - const std::string& mount_point_name) {
|
| - DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
|
| -
|
| - const MountPointNameToIdMap::const_iterator mapping_it =
|
| - mount_point_name_to_id_map_.find(mount_point_name);
|
| - if (mapping_it == mount_point_name_to_id_map_.end())
|
| - return NULL;
|
| -
|
| - const ProvidedFileSystemMap::const_iterator file_system_it =
|
| - file_system_map_.find(mapping_it->second);
|
| - if (file_system_it == file_system_map_.end())
|
| - return NULL;
|
| -
|
| - return file_system_it->second;
|
| -}
|
| -
|
| void Service::Shutdown() {}
|
|
|
| void Service::OnRequestUnmountStatus(
|
|
|