Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / extensions / unpacked_installer.h
index 18a3a91..fc22e3c 100644 (file)
@@ -8,6 +8,7 @@
 #include <string>
 #include <vector>
 
+#include "base/bind.h"
 #include "base/files/file_path.h"
 #include "base/memory/ref_counted.h"
 #include "base/memory/scoped_ptr.h"
@@ -29,6 +30,9 @@ class RequirementsChecker;
 class UnpackedInstaller
     : public base::RefCountedThreadSafe<UnpackedInstaller> {
  public:
+  typedef base::Callback<void(const base::FilePath&, const std::string&)>
+      OnFailureCallback;
+
   static scoped_refptr<UnpackedInstaller> Create(
       ExtensionService* extension_service);
 
@@ -61,6 +65,14 @@ class UnpackedInstaller
     require_modern_manifest_version_ = val;
   }
 
+  void set_on_failure_callback(const OnFailureCallback& callback) {
+    on_failure_callback_ = callback;
+  }
+
+  void set_be_noisy_on_failure(bool be_noisy_on_failure) {
+    be_noisy_on_failure_ = be_noisy_on_failure;
+  }
+
  private:
   friend class base::RefCountedThreadSafe<UnpackedInstaller>;
 
@@ -85,11 +97,14 @@ class UnpackedInstaller
   // the UI thread. In turn, once that gets the pref, it goes back to the
   // file thread with LoadWithFileAccess.
   // TODO(yoz): It would be nice to remove this ping-pong, but we need to know
-  // what file access flags to pass to extension_file_util::LoadExtension.
+  // what file access flags to pass to file_util::LoadExtension.
   void GetAbsolutePath();
   void CheckExtensionFileAccess();
   void LoadWithFileAccess(int flags);
 
+  // Notify the frontend that an attempt to retry will not be necessary.
+  void UnregisterLoadRetryListener();
+
   // Notify the frontend that there was an error loading an extension.
   void ReportExtensionLoadError(const std::string& error);
 
@@ -114,6 +129,12 @@ class UnpackedInstaller
   // version.
   bool require_modern_manifest_version_;
 
+  // An optional callback to set in order to be notified of failure.
+  OnFailureCallback on_failure_callback_;
+
+  // Whether or not to be noisy (show a dialog) on failure. Defaults to true.
+  bool be_noisy_on_failure_;
+
   // Gives access to common methods and data of an extension installer.
   ExtensionInstaller installer_;