summaryrefslogtreecommitdiffstats
path: root/chrome/browser/download/download_item.h
diff options
context:
space:
mode:
authorskerner@chromium.org <skerner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-31 13:42:28 +0000
committerskerner@chromium.org <skerner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-31 13:42:28 +0000
commit089bda66f423cfac13dcd22fd5c1f187524f12a5 (patch)
tree44fe5c4f470d57253409413cf6c63ff786612b78 /chrome/browser/download/download_item.h
parent02a1bc990c558ddb5085c6432866d971c5e71e9f (diff)
downloadchromium_src-089bda66f423cfac13dcd22fd5c1f187524f12a5.zip
chromium_src-089bda66f423cfac13dcd22fd5c1f187524f12a5.tar.gz
chromium_src-089bda66f423cfac13dcd22fd5c1f187524f12a5.tar.bz2
Show that CRX unpacking is happening in the download shelf
BUG=80010 TEST=manual for now Review URL: http://codereview.chromium.org/7047017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@87302 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/download/download_item.h')
-rw-r--r--chrome/browser/download/download_item.h24
1 files changed, 23 insertions, 1 deletions
diff --git a/chrome/browser/download/download_item.h b/chrome/browser/download/download_item.h
index ab04ddf..202ed23 100644
--- a/chrome/browser/download/download_item.h
+++ b/chrome/browser/download/download_item.h
@@ -27,8 +27,11 @@
#include "base/timer.h"
#include "chrome/browser/download/download_process_handle.h"
#include "chrome/browser/download/download_state_info.h"
+#include "content/common/notification_observer.h"
+#include "content/common/notification_registrar.h"
#include "googleurl/src/gurl.h"
+class CrxInstaller;
class DownloadFileManager;
class DownloadManager;
struct DownloadCreateInfo;
@@ -39,7 +42,7 @@ struct DownloadHistoryInfo;
// Destination tab's download view, may refer to a given DownloadItem.
//
// This is intended to be used only on the UI thread.
-class DownloadItem {
+class DownloadItem : public NotificationObserver {
public:
enum DownloadState {
// Download is actively progressing.
@@ -127,6 +130,11 @@ class DownloadItem {
// Notifies our observers periodically.
void UpdateObservers();
+ // NotificationObserver implementation.
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
// Returns true if it is OK to open this download.
bool CanOpenDownload();
@@ -315,6 +323,13 @@ class DownloadItem {
return state_info_.target_name != full_path_.BaseName();
}
+ // Is a CRX installer running on this download?
+ bool IsCrxInstallRuning() const {
+ return (is_extension_install() &&
+ all_data_saved() &&
+ state_ == IN_PROGRESS);
+ }
+
std::string DebugString(bool verbose) const;
#ifdef UNIT_TEST
@@ -336,6 +351,10 @@ class DownloadItem {
void StartProgressTimer();
void StopProgressTimer();
+ // Call to install this item as a CRX. Should only be called on
+ // items which are CRXes. Use is_extension_install() to check.
+ void StartCrxInstall();
+
// State information used by the download manager.
DownloadStateInfo state_info_;
@@ -439,6 +458,9 @@ class DownloadItem {
// only.
bool open_enabled_;
+ // DownloadItem observes CRX installs it initiates.
+ NotificationRegistrar registrar_;
+
DISALLOW_COPY_AND_ASSIGN(DownloadItem);
};