| Index: gin/modules/file_module_provider.h
|
| diff --git a/gin/modules/file_module_provider.h b/gin/modules/file_module_provider.h
|
| index dd75a0feaf1ef2d7e0031533c15ae3e7cd0928a1..f3110dbe6cdb9c5e3905594d1cf7dea9b52c90e1 100644
|
| --- a/gin/modules/file_module_provider.h
|
| +++ b/gin/modules/file_module_provider.h
|
| @@ -9,7 +9,9 @@
|
| #include <string>
|
| #include <vector>
|
|
|
| +#include "base/callback.h"
|
| #include "base/files/file_path.h"
|
| +#include "base/memory/weak_ptr.h"
|
| #include "gin/gin_export.h"
|
| #include "gin/runner.h"
|
|
|
| @@ -27,15 +29,33 @@ class GIN_EXPORT FileModuleProvider {
|
|
|
| // Searches for modules with |ids| in the file system. If found, the modules
|
| // will be executed asynchronously by |runner|.
|
| - void AttempToLoadModules(Runner* runner, const std::set<std::string>& ids);
|
| + void AttemptToLoadModules(Runner* runner, const std::set<std::string>& ids);
|
| +
|
| + void set_completion_callback(
|
| + base::Callback<void(const std::set<std::string>&)> callback) {
|
| + completion_callback_ = callback;
|
| + }
|
| + void reset_completion_callback() {
|
| + completion_callback_.Reset();
|
| + }
|
|
|
| private:
|
| + void OnReadCompleted(const std::string& id, bool success);
|
| +
|
| + base::WeakPtrFactory<FileModuleProvider> weak_factory_;
|
| +
|
| std::vector<base::FilePath> search_paths_;
|
|
|
| // We'll only search for a given module once. We remember the set of modules
|
| // we've already looked for in |attempted_ids_|.
|
| std::set<std::string> attempted_ids_;
|
|
|
| + // The set of modules that have succeeded or failed to load.
|
| + std::set<std::string> successful_ids_;
|
| + std::set<std::string> failed_ids_;
|
| +
|
| + base::Callback<void(const std::set<std::string>&)> completion_callback_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(FileModuleProvider);
|
| };
|
|
|
|
|