| Index: chrome/browser/extensions/extension_file_browser_private_api.cc
|
| ===================================================================
|
| --- chrome/browser/extensions/extension_file_browser_private_api.cc (revision 88850)
|
| +++ chrome/browser/extensions/extension_file_browser_private_api.cc (working copy)
|
| @@ -816,6 +816,12 @@
|
| return Callback::Find(GetTabId());
|
| }
|
|
|
| +void FileDialogFunction::RemoveCallback() {
|
| + // Listeners expect to be invoked exactly once, so we need to remove our
|
| + // callback objects afterwards.
|
| + Callback::Remove(GetTabId());
|
| +}
|
| +
|
| // GetFileSystemRootPathOnFileThread can only be called from the file thread,
|
| // so here we are. This function takes a vector of virtual paths, converts
|
| // them to local paths and calls GetLocalPathsResponseOnUIThread with the
|
| @@ -902,6 +908,7 @@
|
| callback.listener()->FileSelected(files[0],
|
| index,
|
| callback.params());
|
| + RemoveCallback(); // Listeners expect to be invoked exactly once.
|
| }
|
| SendResponse(true);
|
| }
|
| @@ -996,6 +1003,7 @@
|
| DCHECK(!callback.IsNull());
|
| if (!callback.IsNull()) {
|
| callback.listener()->MultiFilesSelected(files, callback.params());
|
| + RemoveCallback(); // Listeners expect to be invoked exactly once.
|
| }
|
| SendResponse(true);
|
| }
|
| @@ -1005,6 +1013,7 @@
|
| DCHECK(!callback.IsNull());
|
| if (!callback.IsNull()) {
|
| callback.listener()->FileSelectionCanceled(callback.params());
|
| + RemoveCallback(); // Listeners expect to be invoked exactly once.
|
| }
|
| SendResponse(true);
|
| return true;
|
|
|