Index: chrome/browser/extensions/zipfile_installer.h |
diff --git a/chrome/browser/extensions/zipfile_installer.h b/chrome/browser/extensions/zipfile_installer.h |
index 39de6137ead07965cdb0a0fcd1f163074dfbad97..66ab1a1c9d9099ef8bc34a4029e7b19f232648f2 100644 |
--- a/chrome/browser/extensions/zipfile_installer.h |
+++ b/chrome/browser/extensions/zipfile_installer.h |
@@ -8,50 +8,53 @@ |
#include <memory> |
#include <string> |
-#include "base/callback.h" |
#include "base/files/file_path.h" |
#include "base/macros.h" |
#include "base/memory/ref_counted.h" |
#include "base/memory/weak_ptr.h" |
-#include "content/public/browser/utility_process_host_client.h" |
+#include "content/public/browser/utility_process_mojo_client.h" |
class ExtensionService; |
-namespace IPC { |
-class Message; |
-} |
- |
namespace extensions { |
-// ZipFileInstaller unzips an extension that is zipped up via a utility process. |
-// The contents are then loaded via UnpackedInstaller. |
-class ZipFileInstaller : public content::UtilityProcessHostClient { |
+namespace mojom { |
+class ExtensionUnpacker; |
+} |
+ |
+// ZipFileInstaller unzips an extension in a utility process. On success, the |
+// extension content is loaded by an extensions::UnpackedInstaller. |
+class ZipFileInstaller : public base::RefCountedThreadSafe<ZipFileInstaller> { |
public: |
- static scoped_refptr<ZipFileInstaller> Create( |
- ExtensionService* extension_service); |
+ static scoped_refptr<ZipFileInstaller> Create(ExtensionService* service); |
- void LoadFromZipFile(const base::FilePath& path); |
+ void LoadFromZipFile(const base::FilePath& zip_file); |
void set_be_noisy_on_failure(bool value) { be_noisy_on_failure_ = value; } |
- // UtilityProcessHostClient |
- bool OnMessageReceived(const IPC::Message& message) override; |
- |
private: |
- explicit ZipFileInstaller(ExtensionService* extension_service); |
- ~ZipFileInstaller() override; |
+ friend class base::RefCountedThreadSafe<ZipFileInstaller>; |
- void PrepareTempDir(); |
- void StartWorkOnIOThread(const base::FilePath& temp_dir); |
- void ReportSuccessOnUIThread(const base::FilePath& unzipped_path); |
- void ReportErrorOnUIThread(const std::string& error); |
+ explicit ZipFileInstaller(ExtensionService* service); |
+ ~ZipFileInstaller(); |
- void OnUnzipSucceeded(const base::FilePath& unzipped_path); |
- void OnUnzipFailed(const std::string& error); |
+ void PrepareTempDir(const base::FilePath& zip_file); |
+ void UnzipOnUIThread(const base::FilePath& unzip_dir); |
+ void UnzipDone(bool success); |
+ void ReportErrorOnUIThread(const std::string& error); |
bool be_noisy_on_failure_; |
base::WeakPtr<ExtensionService> extension_service_weak_; |
- base::FilePath zip_path_; |
+ |
+ // File containing the extension to unzip. |
+ base::FilePath zip_file_; |
+ |
+ // Temporary directory where |zip_file_| is unzipped. |
+ base::FilePath temp_dir_; |
+ |
+ // Utility process used to perform the unzip. |
+ std::unique_ptr<content::UtilityProcessMojoClient<mojom::ExtensionUnpacker>> |
+ utility_process_mojo_client_; |
DISALLOW_COPY_AND_ASSIGN(ZipFileInstaller); |
}; |