Index: chrome/browser/chromeos/file_system_provider/request_manager.cc |
diff --git a/chrome/browser/chromeos/file_system_provider/request_manager.cc b/chrome/browser/chromeos/file_system_provider/request_manager.cc |
index 575dce644bcda02011684aca1d5e45e600adc331..d8aa9bb14d4a07304459f5a32b913aeee3bc4fac 100644 |
--- a/chrome/browser/chromeos/file_system_provider/request_manager.cc |
+++ b/chrome/browser/chromeos/file_system_provider/request_manager.cc |
@@ -11,11 +11,17 @@ namespace file_system_provider { |
RequestManager::RequestManager() : next_id_(1) {} |
-RequestManager::~RequestManager() {} |
+RequestManager::~RequestManager() { |
+ // Abort all of the active requests. |
+ RequestMap::iterator it = requests_.begin(); |
+ while (it != requests_.end()) { |
+ const int request_id = it->first; |
+ ++it; |
+ RejectRequest(request_id, base::File::FILE_ERROR_ABORT); |
+ } |
+} |
-int RequestManager::CreateRequest(const std::string& extension_id, |
- int file_system_id, |
- const SuccessCallback& success_callback, |
+int RequestManager::CreateRequest(const SuccessCallback& success_callback, |
const ErrorCallback& error_callback) { |
// The request id is unique per request manager, so per service, thereof |
// per profile. |
@@ -26,8 +32,6 @@ int RequestManager::CreateRequest(const std::string& extension_id, |
return 0; |
Request request; |
- request.extension_id = extension_id; |
- request.file_system_id = file_system_id; |
request.success_callback = success_callback; |
request.error_callback = error_callback; |
requests_[request_id] = request; |
@@ -35,9 +39,7 @@ int RequestManager::CreateRequest(const std::string& extension_id, |
return request_id; |
} |
-bool RequestManager::FulfillRequest(const std::string& extension_id, |
- int file_system_id, |
- int request_id, |
+bool RequestManager::FulfillRequest(int request_id, |
scoped_ptr<base::DictionaryValue> response, |
bool has_next) { |
RequestMap::iterator request_it = requests_.find(request_id); |
@@ -45,12 +47,6 @@ bool RequestManager::FulfillRequest(const std::string& extension_id, |
if (request_it == requests_.end()) |
return false; |
- // Check if the request belongs to the same provided file system. |
- if (request_it->second.file_system_id != file_system_id || |
- request_it->second.extension_id != extension_id) { |
- return false; |
- } |
- |
if (!request_it->second.success_callback.is_null()) |
request_it->second.success_callback.Run(response.Pass(), has_next); |
if (!has_next) |
@@ -59,21 +55,12 @@ bool RequestManager::FulfillRequest(const std::string& extension_id, |
return true; |
} |
-bool RequestManager::RejectRequest(const std::string& extension_id, |
- int file_system_id, |
- int request_id, |
- base::File::Error error) { |
+bool RequestManager::RejectRequest(int request_id, base::File::Error error) { |
RequestMap::iterator request_it = requests_.find(request_id); |
if (request_it == requests_.end()) |
return false; |
- // Check if the request belongs to the same provided file system. |
- if (request_it->second.file_system_id != file_system_id || |
- request_it->second.extension_id != extension_id) { |
- return false; |
- } |
- |
if (!request_it->second.error_callback.is_null()) |
request_it->second.error_callback.Run(error); |
requests_.erase(request_it); |
@@ -81,34 +68,7 @@ bool RequestManager::RejectRequest(const std::string& extension_id, |
return true; |
} |
-void RequestManager::OnProvidedFileSystemMount( |
- const ProvidedFileSystemInfo& file_system_info, |
- base::File::Error error) {} |
- |
-void RequestManager::OnProvidedFileSystemUnmount( |
- const ProvidedFileSystemInfo& file_system_info, |
- base::File::Error error) { |
- // Do not continue on error, since the volume may be still mounted. |
- if (error != base::File::FILE_OK) |
- return; |
- |
- // Remove all requests for this provided file system. |
- RequestMap::iterator it = requests_.begin(); |
- while (it != requests_.begin()) { |
- if (it->second.file_system_id == file_system_info.file_system_id() && |
- it->second.extension_id == file_system_info.extension_id()) { |
- RejectRequest(it->second.extension_id, |
- it->second.file_system_id, |
- it->first, |
- base::File::FILE_ERROR_ABORT); |
- requests_.erase(it++); |
- } else { |
- ++it; |
- } |
- } |
-} |
- |
-RequestManager::Request::Request() : file_system_id(0) {} |
+RequestManager::Request::Request() {} |
RequestManager::Request::~Request() {} |