Chromium Code Reviews| Index: storage/browser/fileapi/remove_operation_delegate.cc |
| diff --git a/storage/browser/fileapi/remove_operation_delegate.cc b/storage/browser/fileapi/remove_operation_delegate.cc |
| index eb28587fe602645aa879ba44878c7a074fefe68f..9c1250d4bfd15a034e43c6771365551957b14648 100644 |
| --- a/storage/browser/fileapi/remove_operation_delegate.cc |
| +++ b/storage/browser/fileapi/remove_operation_delegate.cc |
| @@ -5,6 +5,7 @@ |
| #include "storage/browser/fileapi/remove_operation_delegate.h" |
| #include "base/bind.h" |
| +#include "storage/browser/fileapi/file_observers.h" |
| #include "storage/browser/fileapi/file_system_context.h" |
| #include "storage/browser/fileapi/file_system_operation_runner.h" |
| @@ -23,6 +24,7 @@ RemoveOperationDelegate::RemoveOperationDelegate( |
| RemoveOperationDelegate::~RemoveOperationDelegate() {} |
| void RemoveOperationDelegate::Run() { |
| + NotifyOnStartUpdate(url_); |
|
tzik
2014/09/17 04:10:19
ditto
iseki
2014/09/17 06:21:45
Done.
|
| operation_runner()->RemoveFile(url_, base::Bind( |
| &RemoveOperationDelegate::DidTryRemoveFile, weak_factory_.GetWeakPtr())); |
| } |
| @@ -33,10 +35,13 @@ void RemoveOperationDelegate::RunRecursively() { |
| void RemoveOperationDelegate::ProcessFile(const FileSystemURL& url, |
| const StatusCallback& callback) { |
| + NotifyOnStartUpdate(url); |
| operation_runner()->RemoveFile( |
| url, |
| base::Bind(&RemoveOperationDelegate::DidRemoveFile, |
| - weak_factory_.GetWeakPtr(), callback)); |
| + weak_factory_.GetWeakPtr(), |
| + url, |
| + callback)); |
| } |
| void RemoveOperationDelegate::ProcessDirectory(const FileSystemURL& url, |
| @@ -46,12 +51,14 @@ void RemoveOperationDelegate::ProcessDirectory(const FileSystemURL& url, |
| void RemoveOperationDelegate::PostProcessDirectory( |
| const FileSystemURL& url, const StatusCallback& callback) { |
| + NotifyOnStartUpdate(url); |
|
tzik
2014/09/17 05:03:06
ditto
iseki
2014/09/17 06:21:45
Done.
|
| operation_runner()->RemoveDirectory(url, callback); |
| } |
| void RemoveOperationDelegate::DidTryRemoveFile(base::File::Error error) { |
| if (error != base::File::FILE_ERROR_NOT_A_FILE && |
| error != base::File::FILE_ERROR_SECURITY) { |
| + NotifyOnEndUpdate(url_); |
|
tzik
2014/09/17 05:03:06
ditto
iseki
2014/09/17 06:21:45
Done.
|
| callback_.Run(error); |
| return; |
| } |
| @@ -64,14 +71,17 @@ void RemoveOperationDelegate::DidTryRemoveFile(base::File::Error error) { |
| void RemoveOperationDelegate::DidTryRemoveDirectory( |
| base::File::Error remove_file_error, |
| base::File::Error remove_directory_error) { |
| + NotifyOnEndUpdate(url_); |
|
tzik
2014/09/17 05:03:06
ditto
iseki
2014/09/17 06:21:45
Done.
|
| callback_.Run( |
| remove_directory_error == base::File::FILE_ERROR_NOT_A_DIRECTORY ? |
| remove_file_error : |
| remove_directory_error); |
| } |
| -void RemoveOperationDelegate::DidRemoveFile(const StatusCallback& callback, |
| +void RemoveOperationDelegate::DidRemoveFile(const FileSystemURL& url, |
| + const StatusCallback& callback, |
| base::File::Error error) { |
| + NotifyOnEndUpdate(url); |
| if (error == base::File::FILE_ERROR_NOT_FOUND) { |
| callback.Run(base::File::FILE_OK); |
| return; |
| @@ -79,4 +89,18 @@ void RemoveOperationDelegate::DidRemoveFile(const StatusCallback& callback, |
| callback.Run(error); |
| } |
| +void RemoveOperationDelegate::NotifyOnStartUpdate(const FileSystemURL& url) { |
| + if (file_system_context()->GetUpdateObservers(url.type())) { |
| + file_system_context()->GetUpdateObservers(url.type())->Notify( |
| + &FileUpdateObserver::OnStartUpdate, MakeTuple(url)); |
| + } |
| +} |
| + |
| +void RemoveOperationDelegate::NotifyOnEndUpdate(const FileSystemURL& url) { |
| + if (file_system_context()->GetUpdateObservers(url.type())) { |
| + file_system_context()->GetUpdateObservers(url.type())->Notify( |
| + &FileUpdateObserver::OnEndUpdate, MakeTuple(url)); |
| + } |
| +} |
| + |
| } // namespace storage |