Chromium Code Reviews| Index: chrome/browser/extensions/webstore_installer.h |
| diff --git a/chrome/browser/extensions/webstore_installer.h b/chrome/browser/extensions/webstore_installer.h |
| index 33dadf0be71c1e47c017adfa4a7526580c071622..ae68ed1580b5944e5fef48d855144b69c91557c4 100644 |
| --- a/chrome/browser/extensions/webstore_installer.h |
| +++ b/chrome/browser/extensions/webstore_installer.h |
| @@ -11,8 +11,11 @@ |
| #include "base/compiler_specific.h" |
| #include "base/memory/ref_counted.h" |
| +#include "content/public/browser/download_id.h" |
| +#include "content/public/browser/download_item.h" |
| #include "content/public/browser/notification_observer.h" |
| #include "content/public/browser/notification_registrar.h" |
| +#include "net/base/net_errors.h" |
| #include "googleurl/src/gurl.h" |
| class FilePath; |
| @@ -24,6 +27,7 @@ class NavigationController; |
| // Downloads and installs extensions from the web store. |
| class WebstoreInstaller : public content::NotificationObserver, |
| + public content::DownloadItem::Observer, |
| public base::RefCounted<WebstoreInstaller> { |
| public: |
| enum Flag { |
| @@ -41,7 +45,6 @@ class WebstoreInstaller : public content::NotificationObserver, |
| const std::string& error) = 0; |
| }; |
| - |
| // 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 |
| @@ -68,6 +71,13 @@ class WebstoreInstaller : public content::NotificationObserver, |
| static void SetDownloadDirectoryForTests(FilePath* directory); |
| private: |
| + // DownloadManager::DownloadUrl callback. |
| + void OnDownloadStarted(content::DownloadId id, net::Error error); |
| + |
| + // DownloadItem::Observer implementation: |
| + virtual void OnDownloadUpdated(content::DownloadItem* download) OVERRIDE; |
| + virtual void OnDownloadOpened(content::DownloadItem* download) OVERRIDE; |
| + |
| // Starts downloading the extension to |file_path|. |
| void StartDownload(const FilePath& file_path); |
| @@ -80,11 +90,15 @@ class WebstoreInstaller : public content::NotificationObserver, |
| // PendingInstall. |
| void ReportSuccess(); |
| + // Removes all observers. |
| + void RemoveObservers(); |
| + |
| content::NotificationRegistrar registrar_; |
| Profile* profile_; |
| Delegate* delegate_; |
| content::NavigationController* controller_; |
| std::string id_; |
| + content::DownloadItem* download_item_; |
|
Mihai Parparita -not on Chrome
2012/03/26 18:46:49
Add a comment about who owns this instance and wha
jstritar
2012/03/26 19:53:36
Done.
|
| int flags_; |
| GURL download_url_; |
| }; |