Index: chrome/browser/extensions/webstore_installer.h |
diff --git a/chrome/browser/extensions/webstore_installer.h b/chrome/browser/extensions/webstore_installer.h |
index 4c81089688b384ba324c012a89e093abaf1d5b5e..c8043550f158bd2c5586800b3ff73ee3f63a6333 100644 |
--- a/chrome/browser/extensions/webstore_installer.h |
+++ b/chrome/browser/extensions/webstore_installer.h |
@@ -10,14 +10,17 @@ |
#include <vector> |
#include "base/compiler_specific.h" |
+#include "base/memory/ref_counted.h" |
#include "content/public/browser/notification_observer.h" |
#include "content/public/browser/notification_registrar.h" |
+#include "googleurl/src/gurl.h" |
-class GURL; |
+class NavigationController; |
class Profile; |
// Downloads and installs extensions from the web store. |
-class WebstoreInstaller : public content::NotificationObserver { |
+class WebstoreInstaller : public content::NotificationObserver, |
+ public base::RefCounted<WebstoreInstaller> { |
public: |
enum Flag { |
FLAG_NONE = 0, |
@@ -34,14 +37,22 @@ class WebstoreInstaller : public content::NotificationObserver { |
const std::string& error) = 0; |
}; |
- explicit WebstoreInstaller(Profile* profile); |
- virtual ~WebstoreInstaller(); |
- // Download and install the extension with the given |id| from the Chrome |
- // Web Store. If |delegate| is not NULL, it will be notified when the |
- // install succeeds or fails. |
+ // Creates a WebstoreInstaller for downloading and installing the extension |
+ // with the given |id| from the Chrome Web Store. If |delegate| is not NULL, |
+ // it will be notified when the install succeeds or fails. The installer will |
+ // use the specified |controller| to download the extension. Only one |
+ // WebstoreInstaller can use a specific controller at any given time. |
// Note: the delegate should stay alive until being called back. |
- void InstallExtension(const std::string& id, Delegate* delegate, int flags); |
+ WebstoreInstaller(Profile* profile, |
+ Delegate* delegate, |
+ NavigationController* controller, |
+ const std::string& id, |
+ int flags); |
+ virtual ~WebstoreInstaller(); |
+ |
+ // Starts downloading and installing the extension. |
+ void Start(); |
// content::NotificationObserver |
virtual void Observe(int type, |
@@ -49,31 +60,22 @@ class WebstoreInstaller : public content::NotificationObserver { |
const content::NotificationDetails& details) OVERRIDE; |
private: |
- struct PendingInstall; |
- |
- // Removes the PendingIntall data for the given extension, returning true and |
- // setting |install| if there is such data. |
- bool ClearPendingInstall(const std::string& id, PendingInstall* install); |
- |
- // Creates the PendingInstall for the specified extension. |
- const PendingInstall& CreatePendingInstall( |
- const std::string& id, GURL install_url, Delegate* delegate); |
- |
- // Gets the extension id for the given gallery install |url|. |
- std::string GetPendingInstallId(const GURL& url); |
- |
// Reports an install |error| to the delegate for the given extension if this |
// managed its installation. This also removes the associated PendingInstall. |
- void ReportFailure(const std::string& id, const std::string& error); |
+ void ReportFailure(const std::string& error); |
// Reports a successful install to the delegate for the given extension if |
// this managed its installation. This also removes the associated |
// PendingInstall. |
- void ReportSuccess(const std::string& id); |
+ void ReportSuccess(); |
content::NotificationRegistrar registrar_; |
Profile* profile_; |
- std::vector<PendingInstall> pending_installs_; |
+ Delegate* delegate_; |
+ NavigationController* controller_; |
+ std::string id_; |
+ int flags_; |
+ GURL download_url_; |
}; |
#endif // CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALLER_H_ |