summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormtomasz@chromium.org <mtomasz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-23 00:54:16 +0000
committermtomasz@chromium.org <mtomasz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-23 00:54:16 +0000
commit13017122a979d36d0384c141cc89a531cb1ac262 (patch)
treeda1c4848dcdb41510a80c32f12a4e89ed993d71b
parent54d558482299dd1ab829eea2beb14cc277df8f13 (diff)
downloadchromium_src-13017122a979d36d0384c141cc89a531cb1ac262.zip
chromium_src-13017122a979d36d0384c141cc89a531cb1ac262.tar.gz
chromium_src-13017122a979d36d0384c141cc89a531cb1ac262.tar.bz2
[fsp] [reland] Cleanup handling errors for operation requests.
This is a reland of https://codereview.chromium.org/335753004/, after reverting because of breaking ASAN bots. Includes a trivial fix. The original description is below. This CL removes redundant internal functions which are identical, and replaces them with one. Moreover, the new general purpose error API function, passes now the entire value to the request manager. This is because, very soon, we are going to pass extra information with every error and success responses and we want to have access to them in the RequestManager. TBR=benwells@chromium.org, isherman@chromium.org, kinaba@chromium.org TEST=unit_tests, browser_tests: *FileSystemProvider* BUG=373165, 384201 Review URL: https://codereview.chromium.org/342893002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@279023 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_api.cc58
-rw-r--r--chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_api.h68
-rw-r--r--chrome/browser/chromeos/extensions/file_system_provider/provider_function.cc3
-rw-r--r--chrome/browser/chromeos/extensions/file_system_provider/provider_function.h4
-rw-r--r--chrome/browser/chromeos/file_system_provider/operations/close_file.cc4
-rw-r--r--chrome/browser/chromeos/file_system_provider/operations/close_file.h4
-rw-r--r--chrome/browser/chromeos/file_system_provider/operations/close_file_unittest.cc10
-rw-r--r--chrome/browser/chromeos/file_system_provider/operations/get_metadata.cc4
-rw-r--r--chrome/browser/chromeos/file_system_provider/operations/get_metadata.h4
-rw-r--r--chrome/browser/chromeos/file_system_provider/operations/get_metadata_unittest.cc9
-rw-r--r--chrome/browser/chromeos/file_system_provider/operations/open_file.cc4
-rw-r--r--chrome/browser/chromeos/file_system_provider/operations/open_file.h4
-rw-r--r--chrome/browser/chromeos/file_system_provider/operations/open_file_unittest.cc10
-rw-r--r--chrome/browser/chromeos/file_system_provider/operations/operation.h4
-rw-r--r--chrome/browser/chromeos/file_system_provider/operations/read_directory.cc4
-rw-r--r--chrome/browser/chromeos/file_system_provider/operations/read_directory.h4
-rw-r--r--chrome/browser/chromeos/file_system_provider/operations/read_directory_unittest.cc9
-rw-r--r--chrome/browser/chromeos/file_system_provider/operations/read_file.cc4
-rw-r--r--chrome/browser/chromeos/file_system_provider/operations/read_file.h4
-rw-r--r--chrome/browser/chromeos/file_system_provider/operations/read_file_unittest.cc7
-rw-r--r--chrome/browser/chromeos/file_system_provider/operations/unmount.cc4
-rw-r--r--chrome/browser/chromeos/file_system_provider/operations/unmount.h4
-rw-r--r--chrome/browser/chromeos/file_system_provider/operations/unmount_unittest.cc7
-rw-r--r--chrome/browser/chromeos/file_system_provider/request_manager.cc16
-rw-r--r--chrome/browser/chromeos/file_system_provider/request_manager.h8
-rw-r--r--chrome/browser/chromeos/file_system_provider/request_manager_unittest.cc38
-rw-r--r--chrome/browser/chromeos/file_system_provider/request_value.cc8
-rw-r--r--chrome/browser/chromeos/file_system_provider/request_value.h12
-rw-r--r--chrome/common/extensions/api/file_system_provider_internal.idl42
-rw-r--r--chrome/renderer/resources/extensions/file_system_provider_custom_bindings.js12
-rw-r--r--extensions/browser/extension_function_histogram_value.h13
-rw-r--r--tools/metrics/histograms/histograms.xml17
32 files changed, 162 insertions, 241 deletions
diff --git a/chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_api.cc b/chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_api.cc
index 5bd2b0a8..108ea94 100644
--- a/chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_api.cc
+++ b/chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_api.cc
@@ -97,15 +97,6 @@ bool FileSystemProviderInternalUnmountRequestedSuccessFunction::RunWhenValid() {
return true;
}
-bool FileSystemProviderInternalUnmountRequestedErrorFunction::RunWhenValid() {
- using api::file_system_provider_internal::UnmountRequestedError::Params;
- const scoped_ptr<Params> params(Params::Create(*args_));
- EXTENSION_FUNCTION_VALIDATE(params);
-
- RejectRequest(ProviderErrorToFileError(params->error));
- return true;
-}
-
bool
FileSystemProviderInternalGetMetadataRequestedSuccessFunction::RunWhenValid() {
using api::file_system_provider_internal::GetMetadataRequestedSuccess::Params;
@@ -117,16 +108,6 @@ FileSystemProviderInternalGetMetadataRequestedSuccessFunction::RunWhenValid() {
return true;
}
-bool
-FileSystemProviderInternalGetMetadataRequestedErrorFunction::RunWhenValid() {
- using api::file_system_provider_internal::GetMetadataRequestedError::Params;
- const scoped_ptr<Params> params(Params::Create(*args_));
- EXTENSION_FUNCTION_VALIDATE(params);
-
- RejectRequest(ProviderErrorToFileError(params->error));
- return true;
-}
-
bool FileSystemProviderInternalReadDirectoryRequestedSuccessFunction::
RunWhenValid() {
using api::file_system_provider_internal::ReadDirectoryRequestedSuccess::
@@ -141,16 +122,6 @@ bool FileSystemProviderInternalReadDirectoryRequestedSuccessFunction::
}
bool
-FileSystemProviderInternalReadDirectoryRequestedErrorFunction::RunWhenValid() {
- using api::file_system_provider_internal::ReadDirectoryRequestedError::Params;
- const scoped_ptr<Params> params(Params::Create(*args_));
- EXTENSION_FUNCTION_VALIDATE(params);
-
- RejectRequest(ProviderErrorToFileError(params->error));
- return true;
-}
-
-bool
FileSystemProviderInternalOpenFileRequestedSuccessFunction::RunWhenValid() {
using api::file_system_provider_internal::OpenFileRequestedSuccess::Params;
scoped_ptr<Params> params(Params::Create(*args_));
@@ -161,15 +132,6 @@ FileSystemProviderInternalOpenFileRequestedSuccessFunction::RunWhenValid() {
return true;
}
-bool FileSystemProviderInternalOpenFileRequestedErrorFunction::RunWhenValid() {
- using api::file_system_provider_internal::OpenFileRequestedError::Params;
- const scoped_ptr<Params> params(Params::Create(*args_));
- EXTENSION_FUNCTION_VALIDATE(params);
-
- RejectRequest(ProviderErrorToFileError(params->error));
- return true;
-}
-
bool
FileSystemProviderInternalCloseFileRequestedSuccessFunction::RunWhenValid() {
using api::file_system_provider_internal::CloseFileRequestedSuccess::Params;
@@ -181,15 +143,6 @@ FileSystemProviderInternalCloseFileRequestedSuccessFunction::RunWhenValid() {
return true;
}
-bool FileSystemProviderInternalCloseFileRequestedErrorFunction::RunWhenValid() {
- using api::file_system_provider_internal::CloseFileRequestedError::Params;
- const scoped_ptr<Params> params(Params::Create(*args_));
- EXTENSION_FUNCTION_VALIDATE(params);
-
- RejectRequest(ProviderErrorToFileError(params->error));
- return true;
-}
-
bool
FileSystemProviderInternalReadFileRequestedSuccessFunction::RunWhenValid() {
using api::file_system_provider_internal::ReadFileRequestedSuccess::Params;
@@ -198,16 +151,17 @@ FileSystemProviderInternalReadFileRequestedSuccessFunction::RunWhenValid() {
const bool has_more = params->has_more;
FulfillRequest(RequestValue::CreateForReadFileSuccess(params.Pass()),
- has_more);
+ has_more);
return true;
}
-bool FileSystemProviderInternalReadFileRequestedErrorFunction::RunWhenValid() {
- using api::file_system_provider_internal::ReadFileRequestedError::Params;
- const scoped_ptr<Params> params(Params::Create(*args_));
+bool FileSystemProviderInternalOperationRequestedErrorFunction::RunWhenValid() {
+ using api::file_system_provider_internal::OperationRequestedError::Params;
+ scoped_ptr<Params> params(Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
- RejectRequest(ProviderErrorToFileError(params->error));
+ const base::File::Error error = ProviderErrorToFileError(params->error);
+ RejectRequest(RequestValue::CreateForOperationError(params.Pass()), error);
return true;
}
diff --git a/chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_api.h b/chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_api.h
index c4c94fd..fa92009 100644
--- a/chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_api.h
+++ b/chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_api.h
@@ -42,18 +42,6 @@ class FileSystemProviderInternalUnmountRequestedSuccessFunction
virtual bool RunWhenValid() OVERRIDE;
};
-class FileSystemProviderInternalUnmountRequestedErrorFunction
- : public FileSystemProviderInternalFunction {
- public:
- DECLARE_EXTENSION_FUNCTION(
- "fileSystemProviderInternal.unmountRequestedError",
- FILESYSTEMPROVIDERINTERNAL_GETMETADATAREQUESTEDERROR)
-
- protected:
- virtual ~FileSystemProviderInternalUnmountRequestedErrorFunction() {}
- virtual bool RunWhenValid() OVERRIDE;
-};
-
class FileSystemProviderInternalGetMetadataRequestedSuccessFunction
: public FileSystemProviderInternalFunction {
public:
@@ -66,18 +54,6 @@ class FileSystemProviderInternalGetMetadataRequestedSuccessFunction
virtual bool RunWhenValid() OVERRIDE;
};
-class FileSystemProviderInternalGetMetadataRequestedErrorFunction
- : public FileSystemProviderInternalFunction {
- public:
- DECLARE_EXTENSION_FUNCTION(
- "fileSystemProviderInternal.getMetadataRequestedError",
- FILESYSTEMPROVIDERINTERNAL_GETMETADATAREQUESTEDERROR)
-
- protected:
- virtual ~FileSystemProviderInternalGetMetadataRequestedErrorFunction() {}
- virtual bool RunWhenValid() OVERRIDE;
-};
-
class FileSystemProviderInternalReadDirectoryRequestedSuccessFunction
: public FileSystemProviderInternalFunction {
public:
@@ -90,18 +66,6 @@ class FileSystemProviderInternalReadDirectoryRequestedSuccessFunction
virtual bool RunWhenValid() OVERRIDE;
};
-class FileSystemProviderInternalReadDirectoryRequestedErrorFunction
- : public FileSystemProviderInternalFunction {
- public:
- DECLARE_EXTENSION_FUNCTION(
- "fileSystemProviderInternal.readDirectoryRequestedError",
- FILESYSTEMPROVIDERINTERNAL_READDIRECTORYREQUESTEDERROR)
-
- protected:
- virtual ~FileSystemProviderInternalReadDirectoryRequestedErrorFunction() {}
- virtual bool RunWhenValid() OVERRIDE;
-};
-
class FileSystemProviderInternalOpenFileRequestedSuccessFunction
: public FileSystemProviderInternalFunction {
public:
@@ -114,18 +78,6 @@ class FileSystemProviderInternalOpenFileRequestedSuccessFunction
virtual bool RunWhenValid() OVERRIDE;
};
-class FileSystemProviderInternalOpenFileRequestedErrorFunction
- : public FileSystemProviderInternalFunction {
- public:
- DECLARE_EXTENSION_FUNCTION(
- "fileSystemProviderInternal.openFileRequestedError",
- FILESYSTEMPROVIDERINTERNAL_OPENFILEREQUESTEDERROR)
-
- protected:
- virtual ~FileSystemProviderInternalOpenFileRequestedErrorFunction() {}
- virtual bool RunWhenValid() OVERRIDE;
-};
-
class FileSystemProviderInternalCloseFileRequestedSuccessFunction
: public FileSystemProviderInternalFunction {
public:
@@ -138,18 +90,6 @@ class FileSystemProviderInternalCloseFileRequestedSuccessFunction
virtual bool RunWhenValid() OVERRIDE;
};
-class FileSystemProviderInternalCloseFileRequestedErrorFunction
- : public FileSystemProviderInternalFunction {
- public:
- DECLARE_EXTENSION_FUNCTION(
- "fileSystemProviderInternal.closeFileRequestedError",
- FILESYSTEMPROVIDERINTERNAL_CLOSEFILEREQUESTEDERROR)
-
- protected:
- virtual ~FileSystemProviderInternalCloseFileRequestedErrorFunction() {}
- virtual bool RunWhenValid() OVERRIDE;
-};
-
class FileSystemProviderInternalReadFileRequestedSuccessFunction
: public FileSystemProviderInternalFunction {
public:
@@ -162,15 +102,15 @@ class FileSystemProviderInternalReadFileRequestedSuccessFunction
virtual bool RunWhenValid() OVERRIDE;
};
-class FileSystemProviderInternalReadFileRequestedErrorFunction
+class FileSystemProviderInternalOperationRequestedErrorFunction
: public FileSystemProviderInternalFunction {
public:
DECLARE_EXTENSION_FUNCTION(
- "fileSystemProviderInternal.readFileRequestedError",
- FILESYSTEMPROVIDERINTERNAL_READFILEREQUESTEDERROR)
+ "fileSystemProviderInternal.operationRequestedError",
+ FILESYSTEMPROVIDERINTERNAL_OPERATIONREQUESTEDERROR)
protected:
- virtual ~FileSystemProviderInternalReadFileRequestedErrorFunction() {}
+ virtual ~FileSystemProviderInternalOperationRequestedErrorFunction() {}
virtual bool RunWhenValid() OVERRIDE;
};
diff --git a/chrome/browser/chromeos/extensions/file_system_provider/provider_function.cc b/chrome/browser/chromeos/extensions/file_system_provider/provider_function.cc
index d77b9f5..0061ee1 100644
--- a/chrome/browser/chromeos/extensions/file_system_provider/provider_function.cc
+++ b/chrome/browser/chromeos/extensions/file_system_provider/provider_function.cc
@@ -83,8 +83,9 @@ FileSystemProviderInternalFunction::FileSystemProviderInternalFunction()
}
void FileSystemProviderInternalFunction::RejectRequest(
+ scoped_ptr<chromeos::file_system_provider::RequestValue> value,
base::File::Error error) {
- if (!request_manager_->RejectRequest(request_id_, error))
+ if (!request_manager_->RejectRequest(request_id_, value.Pass(), error))
SetErrorResponse(kSecurityErrorName, kResponseFailedErrorMessage);
}
diff --git a/chrome/browser/chromeos/extensions/file_system_provider/provider_function.h b/chrome/browser/chromeos/extensions/file_system_provider/provider_function.h
index f4ed7d7..b575d0e 100644
--- a/chrome/browser/chromeos/extensions/file_system_provider/provider_function.h
+++ b/chrome/browser/chromeos/extensions/file_system_provider/provider_function.h
@@ -60,7 +60,9 @@ class FileSystemProviderInternalFunction : public ChromeSyncExtensionFunction {
virtual ~FileSystemProviderInternalFunction() {}
// Rejects the request and sets a response for this API function.
- void RejectRequest(base::File::Error error);
+ void RejectRequest(
+ scoped_ptr<chromeos::file_system_provider::RequestValue> value,
+ base::File::Error error);
// Fulfills the request with parsed arguments of this API function
// encapsulated as a RequestValue instance. Also, sets a response.
diff --git a/chrome/browser/chromeos/file_system_provider/operations/close_file.cc b/chrome/browser/chromeos/file_system_provider/operations/close_file.cc
index c38624c2..ad97736 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/close_file.cc
+++ b/chrome/browser/chromeos/file_system_provider/operations/close_file.cc
@@ -41,7 +41,9 @@ void CloseFile::OnSuccess(int /* request_id */,
callback_.Run(base::File::FILE_OK);
}
-void CloseFile::OnError(int /* request_id */, base::File::Error error) {
+void CloseFile::OnError(int /* request_id */,
+ scoped_ptr<RequestValue> /* result */,
+ base::File::Error error) {
callback_.Run(error);
}
diff --git a/chrome/browser/chromeos/file_system_provider/operations/close_file.h b/chrome/browser/chromeos/file_system_provider/operations/close_file.h
index c9ab99e..83bafff 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/close_file.h
+++ b/chrome/browser/chromeos/file_system_provider/operations/close_file.h
@@ -41,7 +41,9 @@ class CloseFile : public Operation {
virtual void OnSuccess(int request_id,
scoped_ptr<RequestValue> result,
bool has_more) OVERRIDE;
- virtual void OnError(int request_id, base::File::Error error) OVERRIDE;
+ virtual void OnError(int request_id,
+ scoped_ptr<RequestValue> result,
+ base::File::Error error) OVERRIDE;
private:
int open_request_id_;
diff --git a/chrome/browser/chromeos/file_system_provider/operations/close_file_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/close_file_unittest.cc
index c9429e5..316dd06 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/close_file_unittest.cc
+++ b/chrome/browser/chromeos/file_system_provider/operations/close_file_unittest.cc
@@ -144,9 +144,6 @@ TEST_F(FileSystemProviderOperationsCloseFileTest, Execute_NoListener) {
}
TEST_F(FileSystemProviderOperationsCloseFileTest, OnSuccess) {
- using extensions::api::file_system_provider_internal::
- CloseFileRequestedSuccess::Params;
-
LoggingDispatchEventImpl dispatcher(true /* dispatch_reply */);
CallbackLogger callback_logger;
@@ -169,9 +166,6 @@ TEST_F(FileSystemProviderOperationsCloseFileTest, OnSuccess) {
}
TEST_F(FileSystemProviderOperationsCloseFileTest, OnError) {
- using extensions::api::file_system_provider_internal::
- CloseFileRequestedError::Params;
-
LoggingDispatchEventImpl dispatcher(true /* dispatch_reply */);
CallbackLogger callback_logger;
@@ -186,7 +180,9 @@ TEST_F(FileSystemProviderOperationsCloseFileTest, OnError) {
EXPECT_TRUE(close_file.Execute(kRequestId));
- close_file.OnError(kRequestId, base::File::FILE_ERROR_TOO_MANY_OPENED);
+ close_file.OnError(kRequestId,
+ scoped_ptr<RequestValue>(new RequestValue()),
+ base::File::FILE_ERROR_TOO_MANY_OPENED);
ASSERT_EQ(1u, callback_logger.events().size());
EXPECT_EQ(base::File::FILE_ERROR_TOO_MANY_OPENED,
callback_logger.events()[0]);
diff --git a/chrome/browser/chromeos/file_system_provider/operations/get_metadata.cc b/chrome/browser/chromeos/file_system_provider/operations/get_metadata.cc
index 476ac50..dde4ce5 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/get_metadata.cc
+++ b/chrome/browser/chromeos/file_system_provider/operations/get_metadata.cc
@@ -77,7 +77,9 @@ void GetMetadata::OnSuccess(int /* request_id */,
callback_.Run(base::File::FILE_OK, file_info);
}
-void GetMetadata::OnError(int /* request_id */, base::File::Error error) {
+void GetMetadata::OnError(int /* request_id */,
+ scoped_ptr<RequestValue> /* result */,
+ base::File::Error error) {
callback_.Run(error, base::File::Info());
}
diff --git a/chrome/browser/chromeos/file_system_provider/operations/get_metadata.h b/chrome/browser/chromeos/file_system_provider/operations/get_metadata.h
index a41b54c..38eb87b 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/get_metadata.h
+++ b/chrome/browser/chromeos/file_system_provider/operations/get_metadata.h
@@ -39,7 +39,9 @@ class GetMetadata : public Operation {
virtual void OnSuccess(int request_id,
scoped_ptr<RequestValue> result,
bool has_more) OVERRIDE;
- virtual void OnError(int request_id, base::File::Error error) OVERRIDE;
+ virtual void OnError(int request_id,
+ scoped_ptr<RequestValue> result,
+ base::File::Error error) OVERRIDE;
private:
base::FilePath entry_path_;
diff --git a/chrome/browser/chromeos/file_system_provider/operations/get_metadata_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/get_metadata_unittest.cc
index e62efd8..cb72bec 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/get_metadata_unittest.cc
+++ b/chrome/browser/chromeos/file_system_provider/operations/get_metadata_unittest.cc
@@ -164,7 +164,6 @@ TEST_F(FileSystemProviderOperationsGetMetadataTest, Execute_NoListener) {
}
TEST_F(FileSystemProviderOperationsGetMetadataTest, OnSuccess) {
- using extensions::api::file_system_provider::EntryMetadata;
using extensions::api::file_system_provider_internal::
GetMetadataRequestedSuccess::Params;
@@ -230,10 +229,6 @@ TEST_F(FileSystemProviderOperationsGetMetadataTest, OnSuccess) {
}
TEST_F(FileSystemProviderOperationsGetMetadataTest, OnError) {
- using extensions::api::file_system_provider::EntryMetadata;
- using extensions::api::file_system_provider_internal::
- GetMetadataRequestedError::Params;
-
LoggingDispatchEventImpl dispatcher(true /* dispatch_reply */);
CallbackLogger callback_logger;
@@ -248,7 +243,9 @@ TEST_F(FileSystemProviderOperationsGetMetadataTest, OnError) {
EXPECT_TRUE(get_metadata.Execute(kRequestId));
- get_metadata.OnError(kRequestId, base::File::FILE_ERROR_TOO_MANY_OPENED);
+ get_metadata.OnError(kRequestId,
+ scoped_ptr<RequestValue>(new RequestValue()),
+ base::File::FILE_ERROR_TOO_MANY_OPENED);
ASSERT_EQ(1u, callback_logger.events().size());
CallbackLogger::Event* event = callback_logger.events()[0];
diff --git a/chrome/browser/chromeos/file_system_provider/operations/open_file.cc b/chrome/browser/chromeos/file_system_provider/operations/open_file.cc
index b0592e9..0104089 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/open_file.cc
+++ b/chrome/browser/chromeos/file_system_provider/operations/open_file.cc
@@ -64,7 +64,9 @@ void OpenFile::OnSuccess(int request_id,
callback_.Run(request_id, base::File::FILE_OK);
}
-void OpenFile::OnError(int /* request_id */, base::File::Error error) {
+void OpenFile::OnError(int /* request_id */,
+ scoped_ptr<RequestValue> /* result */,
+ base::File::Error error) {
callback_.Run(0 /* file_handle */, error);
}
diff --git a/chrome/browser/chromeos/file_system_provider/operations/open_file.h b/chrome/browser/chromeos/file_system_provider/operations/open_file.h
index e3585db..d0fe1a0 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/open_file.h
+++ b/chrome/browser/chromeos/file_system_provider/operations/open_file.h
@@ -43,7 +43,9 @@ class OpenFile : public Operation {
virtual void OnSuccess(int request_id,
scoped_ptr<RequestValue> result,
bool has_more) OVERRIDE;
- virtual void OnError(int request_id, base::File::Error error) OVERRIDE;
+ virtual void OnError(int request_id,
+ scoped_ptr<RequestValue> result,
+ base::File::Error error) OVERRIDE;
private:
base::FilePath file_path_;
diff --git a/chrome/browser/chromeos/file_system_provider/operations/open_file_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/open_file_unittest.cc
index 9d028cb..b7853d1 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/open_file_unittest.cc
+++ b/chrome/browser/chromeos/file_system_provider/operations/open_file_unittest.cc
@@ -178,9 +178,6 @@ TEST_F(FileSystemProviderOperationsOpenFileTest, Execute_NoListener) {
}
TEST_F(FileSystemProviderOperationsOpenFileTest, OnSuccess) {
- using extensions::api::file_system_provider_internal::
- OpenFileRequestedSuccess::Params;
-
LoggingDispatchEventImpl dispatcher(true /* dispatch_reply */);
CallbackLogger callback_logger;
@@ -207,9 +204,6 @@ TEST_F(FileSystemProviderOperationsOpenFileTest, OnSuccess) {
}
TEST_F(FileSystemProviderOperationsOpenFileTest, OnError) {
- using extensions::api::file_system_provider_internal::OpenFileRequestedError::
- Params;
-
LoggingDispatchEventImpl dispatcher(true /* dispatch_reply */);
CallbackLogger callback_logger;
@@ -226,7 +220,9 @@ TEST_F(FileSystemProviderOperationsOpenFileTest, OnError) {
EXPECT_TRUE(open_file.Execute(kRequestId));
- open_file.OnError(kRequestId, base::File::FILE_ERROR_TOO_MANY_OPENED);
+ open_file.OnError(kRequestId,
+ scoped_ptr<RequestValue>(new RequestValue()),
+ base::File::FILE_ERROR_TOO_MANY_OPENED);
ASSERT_EQ(1u, callback_logger.events().size());
CallbackLogger::Event* event = callback_logger.events()[0];
EXPECT_EQ(base::File::FILE_ERROR_TOO_MANY_OPENED, event->result());
diff --git a/chrome/browser/chromeos/file_system_provider/operations/operation.h b/chrome/browser/chromeos/file_system_provider/operations/operation.h
index 3c1e78a..e5d07eb 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/operation.h
+++ b/chrome/browser/chromeos/file_system_provider/operations/operation.h
@@ -41,7 +41,9 @@ class Operation : public RequestManager::HandlerInterface {
virtual void OnSuccess(int request_id,
scoped_ptr<RequestValue> result,
bool has_more) OVERRIDE = 0;
- virtual void OnError(int request_id, base::File::Error error) OVERRIDE = 0;
+ virtual void OnError(int request_id,
+ scoped_ptr<RequestValue> result,
+ base::File::Error error) OVERRIDE = 0;
// Sets custom dispatchign event implementation for tests.
void SetDispatchEventImplForTesting(
diff --git a/chrome/browser/chromeos/file_system_provider/operations/read_directory.cc b/chrome/browser/chromeos/file_system_provider/operations/read_directory.cc
index f0ae20c..e46b4f5 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/read_directory.cc
+++ b/chrome/browser/chromeos/file_system_provider/operations/read_directory.cc
@@ -84,7 +84,9 @@ void ReadDirectory::OnSuccess(int /* request_id */,
callback_.Run(base::File::FILE_OK, entry_list, has_more);
}
-void ReadDirectory::OnError(int /* request_id */, base::File::Error error) {
+void ReadDirectory::OnError(int /* request_id */,
+ scoped_ptr<RequestValue> /* result */,
+ base::File::Error error) {
callback_.Run(
error, fileapi::AsyncFileUtil::EntryList(), false /* has_more */);
}
diff --git a/chrome/browser/chromeos/file_system_provider/operations/read_directory.h b/chrome/browser/chromeos/file_system_provider/operations/read_directory.h
index 535edad..bc939a6 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/read_directory.h
+++ b/chrome/browser/chromeos/file_system_provider/operations/read_directory.h
@@ -39,7 +39,9 @@ class ReadDirectory : public Operation {
virtual void OnSuccess(int request_id,
scoped_ptr<RequestValue> result,
bool has_more) OVERRIDE;
- virtual void OnError(int request_id, base::File::Error error) OVERRIDE;
+ virtual void OnError(int request_id,
+ scoped_ptr<RequestValue> result,
+ base::File::Error error) OVERRIDE;
private:
base::FilePath directory_path_;
diff --git a/chrome/browser/chromeos/file_system_provider/operations/read_directory_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/read_directory_unittest.cc
index 26ca85c..3764501 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/read_directory_unittest.cc
+++ b/chrome/browser/chromeos/file_system_provider/operations/read_directory_unittest.cc
@@ -171,7 +171,6 @@ TEST_F(FileSystemProviderOperationsReadDirectoryTest, Execute_NoListener) {
}
TEST_F(FileSystemProviderOperationsReadDirectoryTest, OnSuccess) {
- using extensions::api::file_system_provider::EntryMetadata;
using extensions::api::file_system_provider_internal::
ReadDirectoryRequestedSuccess::Params;
@@ -242,10 +241,6 @@ TEST_F(FileSystemProviderOperationsReadDirectoryTest, OnSuccess) {
}
TEST_F(FileSystemProviderOperationsReadDirectoryTest, OnError) {
- using extensions::api::file_system_provider::EntryMetadata;
- using extensions::api::file_system_provider_internal::
- ReadDirectoryRequestedSuccess::Params;
-
LoggingDispatchEventImpl dispatcher(true /* dispatch_reply */);
CallbackLogger callback_logger;
@@ -260,7 +255,9 @@ TEST_F(FileSystemProviderOperationsReadDirectoryTest, OnError) {
EXPECT_TRUE(read_directory.Execute(kRequestId));
- read_directory.OnError(kRequestId, base::File::FILE_ERROR_TOO_MANY_OPENED);
+ read_directory.OnError(kRequestId,
+ scoped_ptr<RequestValue>(new RequestValue()),
+ base::File::FILE_ERROR_TOO_MANY_OPENED);
ASSERT_EQ(1u, callback_logger.events().size());
CallbackLogger::Event* event = callback_logger.events()[0];
diff --git a/chrome/browser/chromeos/file_system_provider/operations/read_file.cc b/chrome/browser/chromeos/file_system_provider/operations/read_file.cc
index 3f0d386..ca0bf5a 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/read_file.cc
+++ b/chrome/browser/chromeos/file_system_provider/operations/read_file.cc
@@ -84,7 +84,9 @@ void ReadFile::OnSuccess(int /* request_id */,
callback_.Run(copy_result, has_more, base::File::FILE_OK);
}
-void ReadFile::OnError(int /* request_id */, base::File::Error error) {
+void ReadFile::OnError(int /* request_id */,
+ scoped_ptr<RequestValue> /* result */,
+ base::File::Error error) {
callback_.Run(0 /* chunk_length */, false /* has_more */, error);
}
diff --git a/chrome/browser/chromeos/file_system_provider/operations/read_file.h b/chrome/browser/chromeos/file_system_provider/operations/read_file.h
index 98b92e0..1d0bc9e 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/read_file.h
+++ b/chrome/browser/chromeos/file_system_provider/operations/read_file.h
@@ -46,7 +46,9 @@ class ReadFile : public Operation {
virtual void OnSuccess(int request_id,
scoped_ptr<RequestValue> result,
bool has_more) OVERRIDE;
- virtual void OnError(int request_id, base::File::Error error) OVERRIDE;
+ virtual void OnError(int request_id,
+ scoped_ptr<RequestValue> result,
+ base::File::Error error) OVERRIDE;
private:
int file_handle_;
diff --git a/chrome/browser/chromeos/file_system_provider/operations/read_file_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/read_file_unittest.cc
index aa92d73..8eec579 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/read_file_unittest.cc
+++ b/chrome/browser/chromeos/file_system_provider/operations/read_file_unittest.cc
@@ -231,9 +231,6 @@ TEST_F(FileSystemProviderOperationsReadFileTest, OnSuccess) {
}
TEST_F(FileSystemProviderOperationsReadFileTest, OnError) {
- using extensions::api::file_system_provider_internal::ReadFileRequestedError::
- Params;
-
LoggingDispatchEventImpl dispatcher(true /* dispatch_reply */);
CallbackLogger callback_logger;
@@ -251,7 +248,9 @@ TEST_F(FileSystemProviderOperationsReadFileTest, OnError) {
EXPECT_TRUE(read_file.Execute(kRequestId));
- read_file.OnError(kRequestId, base::File::FILE_ERROR_TOO_MANY_OPENED);
+ read_file.OnError(kRequestId,
+ scoped_ptr<RequestValue>(new RequestValue()),
+ base::File::FILE_ERROR_TOO_MANY_OPENED);
ASSERT_EQ(1u, callback_logger.events().size());
CallbackLogger::Event* event = callback_logger.events()[0];
diff --git a/chrome/browser/chromeos/file_system_provider/operations/unmount.cc b/chrome/browser/chromeos/file_system_provider/operations/unmount.cc
index 395670a..eb4ccba 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/unmount.cc
+++ b/chrome/browser/chromeos/file_system_provider/operations/unmount.cc
@@ -34,7 +34,9 @@ void Unmount::OnSuccess(int /* request_id */,
callback_.Run(base::File::FILE_OK);
}
-void Unmount::OnError(int /* request_id */, base::File::Error error) {
+void Unmount::OnError(int /* request_id */,
+ scoped_ptr<RequestValue> /* result */,
+ base::File::Error error) {
callback_.Run(error);
}
diff --git a/chrome/browser/chromeos/file_system_provider/operations/unmount.h b/chrome/browser/chromeos/file_system_provider/operations/unmount.h
index 948b540..b6614d4 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/unmount.h
+++ b/chrome/browser/chromeos/file_system_provider/operations/unmount.h
@@ -39,7 +39,9 @@ class Unmount : public Operation {
virtual void OnSuccess(int request_id,
scoped_ptr<RequestValue> result,
bool has_more) OVERRIDE;
- virtual void OnError(int request_id, base::File::Error error) OVERRIDE;
+ virtual void OnError(int request_id,
+ scoped_ptr<RequestValue> result,
+ base::File::Error error) OVERRIDE;
private:
const fileapi::AsyncFileUtil::StatusCallback callback_;
diff --git a/chrome/browser/chromeos/file_system_provider/operations/unmount_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/unmount_unittest.cc
index d2c8f5e..a1c9d82 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/unmount_unittest.cc
+++ b/chrome/browser/chromeos/file_system_provider/operations/unmount_unittest.cc
@@ -162,9 +162,6 @@ TEST_F(FileSystemProviderOperationsUnmountTest, OnSuccess) {
}
TEST_F(FileSystemProviderOperationsUnmountTest, OnError) {
- using extensions::api::file_system_provider_internal::UnmountRequestedError::
- Params;
-
LoggingDispatchEventImpl dispatcher(true /* dispatch_reply */);
CallbackLogger callback_logger;
@@ -178,7 +175,9 @@ TEST_F(FileSystemProviderOperationsUnmountTest, OnError) {
EXPECT_TRUE(unmount.Execute(kRequestId));
- unmount.OnError(kRequestId, base::File::FILE_ERROR_NOT_FOUND);
+ unmount.OnError(kRequestId,
+ scoped_ptr<RequestValue>(new RequestValue()),
+ base::File::FILE_ERROR_NOT_FOUND);
ASSERT_EQ(1u, callback_logger.events().size());
base::File::Error event_result = callback_logger.events()[0];
EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND, event_result);
diff --git a/chrome/browser/chromeos/file_system_provider/request_manager.cc b/chrome/browser/chromeos/file_system_provider/request_manager.cc
index 9abe554..6fb39dd 100644
--- a/chrome/browser/chromeos/file_system_provider/request_manager.cc
+++ b/chrome/browser/chromeos/file_system_provider/request_manager.cc
@@ -49,7 +49,9 @@ RequestManager::~RequestManager() {
while (it != requests_.end()) {
const int request_id = it->first;
++it;
- RejectRequest(request_id, base::File::FILE_ERROR_ABORT);
+ RejectRequest(request_id,
+ scoped_ptr<RequestValue>(new RequestValue()),
+ base::File::FILE_ERROR_ABORT);
}
DCHECK_EQ(0u, requests_.size());
@@ -111,15 +113,15 @@ bool RequestManager::FulfillRequest(int request_id,
return true;
}
-bool RequestManager::RejectRequest(int request_id, base::File::Error error) {
+bool RequestManager::RejectRequest(int request_id,
+ scoped_ptr<RequestValue> response,
+ base::File::Error error) {
RequestMap::iterator request_it = requests_.find(request_id);
if (request_it == requests_.end())
return false;
- request_it->second->handler->OnError(request_id, error);
-
+ request_it->second->handler->OnError(request_id, response.Pass(), error);
FOR_EACH_OBSERVER(Observer, observers_, OnRequestRejected(request_id, error));
-
DestroyRequest(request_id);
return true;
@@ -150,7 +152,9 @@ RequestManager::Request::~Request() {}
void RequestManager::OnRequestTimeout(int request_id) {
FOR_EACH_OBSERVER(Observer, observers_, OnRequestTimeouted(request_id));
- RejectRequest(request_id, base::File::FILE_ERROR_ABORT);
+ RejectRequest(request_id,
+ scoped_ptr<RequestValue>(new RequestValue()),
+ base::File::FILE_ERROR_ABORT);
}
void RequestManager::DestroyRequest(int request_id) {
diff --git a/chrome/browser/chromeos/file_system_provider/request_manager.h b/chrome/browser/chromeos/file_system_provider/request_manager.h
index c1cb5d5..4518bfa 100644
--- a/chrome/browser/chromeos/file_system_provider/request_manager.h
+++ b/chrome/browser/chromeos/file_system_provider/request_manager.h
@@ -59,7 +59,9 @@ class RequestManager {
// Error callback invoked by the providing extension in response to
// Execute(). It can be called at most once. It can be also called if the
// request is aborted due to a timeout.
- virtual void OnError(int request_id, base::File::Error error) = 0;
+ virtual void OnError(int request_id,
+ scoped_ptr<RequestValue> result,
+ base::File::Error error) = 0;
};
// Observes activities in the request manager.
@@ -103,7 +105,9 @@ class RequestManager {
// Handles error response for the |request_id|. If handling the error fails,
// returns false. Always disposes the request.
- bool RejectRequest(int request_id, base::File::Error error);
+ bool RejectRequest(int request_id,
+ scoped_ptr<RequestValue> response,
+ base::File::Error error);
// Sets a custom timeout for tests. The new timeout value will be applied to
// new requests
diff --git a/chrome/browser/chromeos/file_system_provider/request_manager_unittest.cc b/chrome/browser/chromeos/file_system_provider/request_manager_unittest.cc
index 49fcefe..b4956a9 100644
--- a/chrome/browser/chromeos/file_system_provider/request_manager_unittest.cc
+++ b/chrome/browser/chromeos/file_system_provider/request_manager_unittest.cc
@@ -56,15 +56,19 @@ class EventLogger {
class ErrorEvent {
public:
- ErrorEvent(int request_id, base::File::Error error)
- : request_id_(request_id), error_(error) {}
+ ErrorEvent(int request_id,
+ scoped_ptr<RequestValue> result,
+ base::File::Error error)
+ : request_id_(request_id), result_(result.Pass()), error_(error) {}
virtual ~ErrorEvent() {}
int request_id() { return request_id_; }
+ RequestValue* result() { return result_.get(); }
base::File::Error error() { return error_; }
private:
int request_id_;
+ scoped_ptr<RequestValue> result_;
base::File::Error error_;
};
@@ -82,8 +86,10 @@ class EventLogger {
new SuccessEvent(request_id, result.Pass(), has_more));
}
- void OnError(int request_id, base::File::Error error) {
- error_events_.push_back(new ErrorEvent(request_id, error));
+ void OnError(int request_id,
+ scoped_ptr<RequestValue> result,
+ base::File::Error error) {
+ error_events_.push_back(new ErrorEvent(request_id, result.Pass(), error));
}
ScopedVector<ExecuteEvent>& execute_events() { return execute_events_; }
@@ -129,9 +135,11 @@ class FakeHandler : public RequestManager::HandlerInterface {
}
// RequestManager::Handler overrides.
- virtual void OnError(int request_id, base::File::Error error) OVERRIDE {
+ virtual void OnError(int request_id,
+ scoped_ptr<RequestValue> result,
+ base::File::Error error) OVERRIDE {
if (logger_.get())
- logger_->OnError(request_id, error);
+ logger_->OnError(request_id, result.Pass(), error);
}
virtual ~FakeHandler() {}
@@ -335,8 +343,10 @@ TEST_F(FileSystemProviderRequestManagerTest, CreateAndFulFill) {
// Rejecting should also fail.
{
- bool retry = request_manager_->RejectRequest(request_id,
- base::File::FILE_ERROR_FAILED);
+ bool retry = request_manager_->RejectRequest(
+ request_id,
+ scoped_ptr<RequestValue>(new RequestValue()),
+ base::File::FILE_ERROR_FAILED);
EXPECT_FALSE(retry);
EXPECT_EQ(0u, observer.rejected().size());
}
@@ -439,7 +449,8 @@ TEST_F(FileSystemProviderRequestManagerTest, CreateAndReject) {
EXPECT_EQ(request_id, observer.executed()[0].request_id());
base::File::Error error = base::File::FILE_ERROR_NO_MEMORY;
- bool result = request_manager_->RejectRequest(request_id, error);
+ bool result = request_manager_->RejectRequest(
+ request_id, scoped_ptr<RequestValue>(new RequestValue()), error);
EXPECT_TRUE(result);
// Validate if the callback has correct arguments.
@@ -465,7 +476,8 @@ TEST_F(FileSystemProviderRequestManagerTest, CreateAndReject) {
// Rejecting should also fail.
{
- bool retry = request_manager_->RejectRequest(request_id, error);
+ bool retry = request_manager_->RejectRequest(
+ request_id, scoped_ptr<RequestValue>(new RequestValue()), error);
EXPECT_FALSE(retry);
EXPECT_EQ(1u, observer.rejected().size());
}
@@ -547,7 +559,8 @@ TEST_F(FileSystemProviderRequestManagerTest,
EXPECT_EQ(request_id, observer.executed()[0].request_id());
base::File::Error error = base::File::FILE_ERROR_NO_MEMORY;
- bool result = request_manager_->RejectRequest(request_id + 1, error);
+ bool result = request_manager_->RejectRequest(
+ request_id + 1, scoped_ptr<RequestValue>(new RequestValue()), error);
EXPECT_FALSE(result);
// Callbacks should not be called.
@@ -558,7 +571,8 @@ TEST_F(FileSystemProviderRequestManagerTest,
// Confirm, that the request hasn't been removed, by rejecting it correctly.
{
- bool retry = request_manager_->RejectRequest(request_id, error);
+ bool retry = request_manager_->RejectRequest(
+ request_id, scoped_ptr<RequestValue>(new RequestValue()), error);
EXPECT_TRUE(retry);
EXPECT_EQ(1u, observer.rejected().size());
}
diff --git a/chrome/browser/chromeos/file_system_provider/request_value.cc b/chrome/browser/chromeos/file_system_provider/request_value.cc
index 53744d2..73d98fc 100644
--- a/chrome/browser/chromeos/file_system_provider/request_value.cc
+++ b/chrome/browser/chromeos/file_system_provider/request_value.cc
@@ -45,6 +45,14 @@ scoped_ptr<RequestValue> RequestValue::CreateForReadFileSuccess(
return result.Pass();
}
+scoped_ptr<RequestValue> RequestValue::CreateForOperationError(
+ scoped_ptr<extensions::api::file_system_provider_internal::
+ OperationRequestedError::Params> params) {
+ scoped_ptr<RequestValue> result(new RequestValue);
+ result->operation_error_params_ = params.Pass();
+ return result.Pass();
+}
+
scoped_ptr<RequestValue> RequestValue::CreateForTesting(
const std::string& params) {
scoped_ptr<RequestValue> result(new RequestValue);
diff --git a/chrome/browser/chromeos/file_system_provider/request_value.h b/chrome/browser/chromeos/file_system_provider/request_value.h
index 3920afb..b7c38f3 100644
--- a/chrome/browser/chromeos/file_system_provider/request_value.h
+++ b/chrome/browser/chromeos/file_system_provider/request_value.h
@@ -40,6 +40,10 @@ class RequestValue {
scoped_ptr<extensions::api::file_system_provider_internal::
ReadFileRequestedSuccess::Params> params);
+ static scoped_ptr<RequestValue> CreateForOperationError(
+ scoped_ptr<extensions::api::file_system_provider_internal::
+ OperationRequestedError::Params> params);
+
static scoped_ptr<RequestValue> CreateForTesting(const std::string& params);
const extensions::api::file_system_provider_internal::
@@ -66,6 +70,12 @@ class RequestValue {
return read_file_success_params_.get();
}
+ const extensions::api::file_system_provider_internal::
+ OperationRequestedError::Params*
+ operation_error_params() const {
+ return operation_error_params_.get();
+ }
+
const std::string* testing_params() const { return testing_params_.get(); }
private:
@@ -79,6 +89,8 @@ class RequestValue {
read_directory_success_params_;
scoped_ptr<extensions::api::file_system_provider_internal::
ReadFileRequestedSuccess::Params> read_file_success_params_;
+ scoped_ptr<extensions::api::file_system_provider_internal::
+ OperationRequestedError::Params> operation_error_params_;
scoped_ptr<std::string> testing_params_;
DISALLOW_COPY_AND_ASSIGN(RequestValue);
diff --git a/chrome/common/extensions/api/file_system_provider_internal.idl b/chrome/common/extensions/api/file_system_provider_internal.idl
index c349e9a..974f69b 100644
--- a/chrome/common/extensions/api/file_system_provider_internal.idl
+++ b/chrome/common/extensions/api/file_system_provider_internal.idl
@@ -13,13 +13,6 @@ namespace fileSystemProviderInternal {
static void unmountRequestedSuccess(DOMString fileSystemId,
long requestId);
- // Internal. Error callback of the <code>onUnmountRequested</code>
- // event. Must be called if unmounting fails.
- static void unmountRequestedError(
- DOMString fileSystemId,
- long requestId,
- fileSystemProvider.ProviderError error);
-
// Internal. Success callback of the <code>onGetMetadataRequested</code>
// event. Must be called if metadata is available.
static void getMetadataRequestedSuccess(
@@ -27,13 +20,6 @@ namespace fileSystemProviderInternal {
long requestId,
fileSystemProvider.EntryMetadata metadata);
- // Internal. Error callback of the <code>onGetMetadataRequested</code>
- // event. Must be called when obtaining metadata fails.
- static void getMetadataRequestedError(
- DOMString fileSystemId,
- long requestId,
- fileSystemProvider.ProviderError error);
-
// Internal. Success callback of the <code>onReadDirectoryRequested</code>
// event. Can be called multiple times per request.
static void readDirectoryRequestedSuccess(
@@ -42,39 +28,18 @@ namespace fileSystemProviderInternal {
fileSystemProvider.EntryMetadata[] entries,
boolean hasMore);
- // Internal. Error callback of the <code>onReadDirectoryRequested</code>
- // event. Must be called when reading a directory fails.
- static void readDirectoryRequestedError(
- DOMString fileSystemId,
- long requestId,
- fileSystemProvider.ProviderError error);
-
// Internal. Success callback of the <code>onOpenFileRequested</code> event.
// Must be called, when opening succeeds.
static void openFileRequestedSuccess(
DOMString fileSystemId,
long requestId);
- // Internal. Error callback of the <code>onOpenFileRequested</code> event.
- // Must be called when opening fails.
- static void openFileRequestedError(
- DOMString fileSystemId,
- long requestId,
- fileSystemProvider.ProviderError error);
-
// Internal. Success callback of the <code>onCloseFileRequested</code>
// event. Must be called, when closing succeeds.
static void closeFileRequestedSuccess(
DOMString fileSystemId,
long requestId);
- // Internal. Error callback of the <code>onCloseFileRequested</code> event.
- // Must be called when closing fails.
- static void closeFileRequestedError(
- DOMString fileSystemId,
- long requestId,
- fileSystemProvider.ProviderError error);
-
// Internal. Success callback of the <code>onReadFileRequested</code>
// event. Can be called multiple times per request.
static void readFileRequestedSuccess(
@@ -83,12 +48,13 @@ namespace fileSystemProviderInternal {
ArrayBuffer data,
boolean hasMore);
- // Internal. Error callback of the <code>onReadFileRequested</code>
- // event. Must be called when reading a file fails.
- static void readFileRequestedError(
+ // Internal. Error callback of all of the operation requests. Must be called
+ // if an operation fails.
+ static void operationRequestedError(
DOMString fileSystemId,
long requestId,
fileSystemProvider.ProviderError error);
+
};
};
diff --git a/chrome/renderer/resources/extensions/file_system_provider_custom_bindings.js b/chrome/renderer/resources/extensions/file_system_provider_custom_bindings.js
index d0dffce..9a097f1 100644
--- a/chrome/renderer/resources/extensions/file_system_provider_custom_bindings.js
+++ b/chrome/renderer/resources/extensions/file_system_provider_custom_bindings.js
@@ -116,7 +116,7 @@ eventBindings.registerArgumentMassager(
options.fileSystemId, options.requestId);
};
var onErrorCallback = function(error) {
- fileSystemProviderInternal.unmountRequestedError(
+ fileSystemProviderInternal.operationRequestedError(
options.fileSystemId, options.requestId, error);
}
dispatch([options, onSuccessCallback, onErrorCallback]);
@@ -133,7 +133,7 @@ eventBindings.registerArgumentMassager(
annotateMetadata(metadata));
};
var onErrorCallback = function(error) {
- fileSystemProviderInternal.getMetadataRequestedError(
+ fileSystemProviderInternal.operationRequestedError(
options.fileSystemId, options.requestId, error);
}
dispatch([options, onSuccessCallback, onErrorCallback]);
@@ -149,7 +149,7 @@ eventBindings.registerArgumentMassager(
options.fileSystemId, options.requestId, annotatedEntries, hasNext);
};
var onErrorCallback = function(error) {
- fileSystemProviderInternal.readDirectoryRequestedError(
+ fileSystemProviderInternal.operationRequestedError(
options.fileSystemId, options.requestId, error);
}
dispatch([options, onSuccessCallback, onErrorCallback]);
@@ -164,7 +164,7 @@ eventBindings.registerArgumentMassager(
options.fileSystemId, options.requestId);
};
var onErrorCallback = function(error) {
- fileSystemProviderInternal.openFileRequestedError(
+ fileSystemProviderInternal.operationRequestedError(
options.fileSystemId, options.requestId, error);
}
dispatch([options, onSuccessCallback, onErrorCallback]);
@@ -179,7 +179,7 @@ eventBindings.registerArgumentMassager(
options.fileSystemId, options.requestId);
};
var onErrorCallback = function(error) {
- fileSystemProviderInternal.closeFileRequestedError(
+ fileSystemProviderInternal.operationRequestedError(
options.fileSystemId, options.requestId, error);
}
dispatch([options, onSuccessCallback, onErrorCallback]);
@@ -194,7 +194,7 @@ eventBindings.registerArgumentMassager(
options.fileSystemId, options.requestId, data, hasNext);
};
var onErrorCallback = function(error) {
- fileSystemProviderInternal.readFileRequestedError(
+ fileSystemProviderInternal.operationRequestedError(
options.fileSystemId, options.requestId, error);
}
dispatch([options, onSuccessCallback, onErrorCallback]);
diff --git a/extensions/browser/extension_function_histogram_value.h b/extensions/browser/extension_function_histogram_value.h
index 7d0263a..44beada 100644
--- a/extensions/browser/extension_function_histogram_value.h
+++ b/extensions/browser/extension_function_histogram_value.h
@@ -776,7 +776,7 @@ enum HistogramValue {
DELETED_BLUETOOTH_GET_SOCKETS,
FILESYSTEMPROVIDER_UNMOUNT,
FILESYSTEMPROVIDERINTERNAL_UNMOUNTREQUESTEDSUCCESS,
- FILESYSTEMPROVIDERINTERNAL_UNMOUNTREQUESTEDERROR,
+ DELETED_FILESYSTEMPROVIDERINTERNAL_UNMOUNTREQUESTEDERROR,
MEDIAGALLERIES_DROPPERMISSIONFORMEDIAFILESYSTEM,
WEBCAMPRIVATE_SET,
WEBCAMPRIVATE_RESET,
@@ -809,7 +809,7 @@ enum HistogramValue {
WEBSTOREPRIVATE_SIGNINFUNCTION,
SHELL_CREATEWINDOW,
FILESYSTEMPROVIDERINTERNAL_GETMETADATAREQUESTEDSUCCESS,
- FILESYSTEMPROVIDERINTERNAL_GETMETADATAREQUESTEDERROR,
+ DELETED_FILESYSTEMPROVIDERINTERNAL_GETMETADATAREQUESTEDERROR,
BROWSER_OPENTAB,
MANAGEMENT_CREATEAPPSHORTCUT,
WEBVIEW_SHOWCONTEXTMENU,
@@ -819,19 +819,19 @@ enum HistogramValue {
HOTWORDPRIVATE_SETHOTWORDSESSIONSTATE,
HOTWORDPRIVATE_NOTIFYHOTWORDRECOGNITION,
FILESYSTEMPROVIDERINTERNAL_READDIRECTORYREQUESTEDSUCCESS,
- FILESYSTEMPROVIDERINTERNAL_READDIRECTORYREQUESTEDERROR,
+ DELETED_FILESYSTEMPROVIDERINTERNAL_READDIRECTORYREQUESTEDERROR,
LEDGER_BATCHEXECUTE,
FILESYSTEMPROVIDERINTERNAL_OPENFILEREQUESTEDSUCCESS,
- FILESYSTEMPROVIDERINTERNAL_OPENFILEREQUESTEDERROR,
+ DELETED_FILESYSTEMPROVIDERINTERNAL_OPENFILEREQUESTEDERROR,
FILESYSTEMPROVIDERINTERNAL_CLOSEFILEREQUESTEDSUCCESS,
- FILESYSTEMPROVIDERINTERNAL_CLOSEFILEREQUESTEDERROR,
+ DELETED_FILESYSTEMPROVIDERINTERNAL_CLOSEFILEREQUESTEDERROR,
SYNCEDNOTIFICATIONSPRIVATE_GETINITIALDATA,
SYNCEDNOTIFICATIONSPRIVATE_UPDATENOTIFICATION,
SYNCEDNOTIFICATIONSPRIVATE_SETRENDERCONTEXT,
IDENTITY_GETACCOUNTS,
FILEBROWSERPRIVATE_RESOLVEISOLATEDENTRIES,
FILESYSTEMPROVIDERINTERNAL_READFILEREQUESTEDSUCCESS,
- FILESYSTEMPROVIDERINTERNAL_READFILEREQUESTEDERROR,
+ DELETED_FILESYSTEMPROVIDERINTERNAL_READFILEREQUESTEDERROR,
NETWORKINGPRIVATE_GETNETWORKS,
WEBVIEW_SETNAME,
ENTERPRISE_PLATFORMKEYSINTERNAL_GENERATEKEY,
@@ -855,6 +855,7 @@ enum HistogramValue {
BLUETOOTHLOWENERGY_DISCONNECT,
WEBSTOREPRIVATE_GETEPHEMERALAPPSENABLED,
WEBSTOREPRIVATE_LAUNCHEPHEMERALAPP,
+ FILESYSTEMPROVIDERINTERNAL_OPERATIONREQUESTEDERROR,
// Last entry: Add new entries above and ensure to update
// tools/metrics/histograms/histograms/histograms.xml.
ENUM_BOUNDARY
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml
index 41793eb..5a9f77c 100644
--- a/tools/metrics/histograms/histograms.xml
+++ b/tools/metrics/histograms/histograms.xml
@@ -36585,7 +36585,8 @@ Therefore, the affected-histogram name has to have at least one dot in it.
<int value="715" label="DELETED_BLUETOOTH_GET_SOCKETS"/>
<int value="716" label="FILESYSTEMPROVIDER_UNMOUNT"/>
<int value="717" label="FILESYSTEMPROVIDERINTERNAL_UNMOUNTREQUESTEDSUCCESS"/>
- <int value="718" label="FILESYSTEMPROVIDERINTERNAL_UNMOUNTREQUESTEDERROR"/>
+ <int value="718"
+ label="DELETED_FILESYSTEMPROVIDERINTERNAL_UNMOUNTREQUESTEDERROR"/>
<int value="719" label="MEDIAGALLERIES_DROPPERMISSIONFORMEDIAFILESYSTEM"/>
<int value="720" label="WEBCAMPRIVATE_SET"/>
<int value="721" label="WEBCAMPRIVATE_RESET"/>
@@ -36620,7 +36621,7 @@ Therefore, the affected-histogram name has to have at least one dot in it.
<int value="750"
label="FILESYSTEMPROVIDERINTERNAL_GETMETADATAREQUESTEDSUCCESS"/>
<int value="751"
- label="FILESYSTEMPROVIDERINTERNAL_GETMETADATAREQUESTEDERROR"/>
+ label="DELETED_FILESYSTEMPROVIDERINTERNAL_GETMETADATAREQUESTEDERROR"/>
<int value="752" label="BROWSER_OPENTAB"/>
<int value="753" label="MANAGEMENT_CREATEAPPSHORTCUT"/>
<int value="754" label="WEBVIEW_SHOWCONTEXTMENU"/>
@@ -36632,20 +36633,23 @@ Therefore, the affected-histogram name has to have at least one dot in it.
<int value="760"
label="FILESYSTEMPROVIDERINTERNAL_READDIRECTORYREQUESTEDSUCCESS"/>
<int value="761"
- label="FILESYSTEMPROVIDERINTERNAL_READDIRECTORYREQUESTEDERROR"/>
+ label="DELETED_FILESYSTEMPROVIDERINTERNAL_READDIRECTORYREQUESTEDERROR"/>
<int value="762" label="LEDGER_BATCHEXECUTE"/>
<int value="763" label="FILESYSTEMPROVIDERINTERNAL_OPENFILEREQUESTEDSUCCESS"/>
- <int value="764" label="FILESYSTEMPROVIDERINTERNAL_OPENFILEREQUESTEDERROR"/>
+ <int value="764"
+ label="DELETED_FILESYSTEMPROVIDERINTERNAL_OPENFILEREQUESTEDERROR"/>
<int value="765"
label="FILESYSTEMPROVIDERINTERNAL_CLOSEFILEREQUESTEDSUCCESS"/>
- <int value="766" label="FILESYSTEMPROVIDERINTERNAL_CLOSEFILEREQUESTEDERROR"/>
+ <int value="766"
+ label="DELETED_FILESYSTEMPROVIDERINTERNAL_CLOSEFILEREQUESTEDERROR"/>
<int value="767" label="SYNCEDNOTIFICATIONSPRIVATE_GETINITIALDATA"/>
<int value="768" label="SYNCEDNOTIFICATIONSPRIVATE_UPDATENOTIFICATION"/>
<int value="769" label="SYNCEDNOTIFICATIONSPRIVATE_SETRENDERCONTEXT"/>
<int value="770" label="IDENTITY_GETACCOUNTS"/>
<int value="771" label="FILEBROWSERPRIVATE_RESOLVEISOLATEDENTRIES"/>
<int value="772" label="FILESYSTEMPROVIDERINTERNAL_READFILEREQUESTEDSUCCESS"/>
- <int value="773" label="FILESYSTEMPROVIDERINTERNAL_READFILEREQUESTEDERROR"/>
+ <int value="773"
+ label="DELETED_FILESYSTEMPROVIDERINTERNAL_READFILEREQUESTEDERROR"/>
<int value="774" label="NETWORKINGPRIVATE_GETNETWORKS"/>
<int value="775" label="WEBVIEW_SETNAME"/>
<int value="776" label="ENTERPRISE_PLATFORMKEYSINTERNAL_GENERATEKEY"/>
@@ -36669,6 +36673,7 @@ Therefore, the affected-histogram name has to have at least one dot in it.
<int value="794" label="BLUETOOTHLOWENERGY_DISCONNECT"/>
<int value="795" label="WEBSTOREPRIVATE_GETEPHEMERALAPPSENABLED"/>
<int value="796" label="WEBSTOREPRIVATE_LAUNCHEPHEMERALAPP"/>
+ <int value="797" label="FILESYSTEMPROVIDERINTERNAL_OPERATIONREQUESTEDERROR"/>
</enum>
<enum name="ExtensionInstallCause" type="int">