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

Unified Diff: chrome/browser/chromeos/file_system_provider/request_manager.cc

Issue 210803003: [fsp] Decouple file_service_provider::Service. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments. Created 6 years, 8 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/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 4083f5780eb30e3fd07d5ee0b598660bfa754b6a..575dce644bcda02011684aca1d5e45e600adc331 100644
--- a/chrome/browser/chromeos/file_system_provider/request_manager.cc
+++ b/chrome/browser/chromeos/file_system_provider/request_manager.cc
@@ -13,7 +13,8 @@ RequestManager::RequestManager() : next_id_(1) {}
RequestManager::~RequestManager() {}
-int RequestManager::CreateRequest(const ProvidedFileSystem& file_system,
+int RequestManager::CreateRequest(const std::string& extension_id,
+ int file_system_id,
const SuccessCallback& success_callback,
const ErrorCallback& error_callback) {
// The request id is unique per request manager, so per service, thereof
@@ -25,7 +26,8 @@ int RequestManager::CreateRequest(const ProvidedFileSystem& file_system,
return 0;
Request request;
- request.file_system = file_system;
+ 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;
@@ -33,7 +35,8 @@ int RequestManager::CreateRequest(const ProvidedFileSystem& file_system,
return request_id;
}
-bool RequestManager::FulfillRequest(const ProvidedFileSystem& file_system,
+bool RequestManager::FulfillRequest(const std::string& extension_id,
+ int file_system_id,
int request_id,
scoped_ptr<base::DictionaryValue> response,
bool has_next) {
@@ -43,8 +46,8 @@ bool RequestManager::FulfillRequest(const ProvidedFileSystem& file_system,
return false;
// Check if the request belongs to the same provided file system.
- if (request_it->second.file_system.file_system_id() !=
- file_system.file_system_id()) {
+ if (request_it->second.file_system_id != file_system_id ||
+ request_it->second.extension_id != extension_id) {
return false;
}
@@ -56,7 +59,8 @@ bool RequestManager::FulfillRequest(const ProvidedFileSystem& file_system,
return true;
}
-bool RequestManager::RejectRequest(const ProvidedFileSystem& file_system,
+bool RequestManager::RejectRequest(const std::string& extension_id,
+ int file_system_id,
int request_id,
base::File::Error error) {
RequestMap::iterator request_it = requests_.find(request_id);
@@ -65,8 +69,8 @@ bool RequestManager::RejectRequest(const ProvidedFileSystem& file_system,
return false;
// Check if the request belongs to the same provided file system.
- if (request_it->second.file_system.file_system_id() !=
- file_system.file_system_id()) {
+ if (request_it->second.file_system_id != file_system_id ||
+ request_it->second.extension_id != extension_id) {
return false;
}
@@ -78,11 +82,11 @@ bool RequestManager::RejectRequest(const ProvidedFileSystem& file_system,
}
void RequestManager::OnProvidedFileSystemMount(
- const ProvidedFileSystem& file_system,
+ const ProvidedFileSystemInfo& file_system_info,
base::File::Error error) {}
void RequestManager::OnProvidedFileSystemUnmount(
- const ProvidedFileSystem& file_system,
+ 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)
@@ -91,18 +95,20 @@ void RequestManager::OnProvidedFileSystemUnmount(
// Remove all requests for this provided file system.
RequestMap::iterator it = requests_.begin();
while (it != requests_.begin()) {
- if (it->second.file_system.file_system_id() ==
- file_system.file_system_id()) {
- RejectRequest(
- it->second.file_system, it->first, base::File::FILE_ERROR_ABORT);
+ 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++;
+ ++it;
}
}
}
-RequestManager::Request::Request() {}
+RequestManager::Request::Request() : file_system_id(0) {}
RequestManager::Request::~Request() {}

Powered by Google App Engine
This is Rietveld 408576698