summaryrefslogtreecommitdiffstats
path: root/content/browser/download/download_item.h
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-23 19:28:00 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-23 19:28:00 +0000
commit8a282714107a45d1341265f18774264fe02de77b (patch)
tree7f81dcd0b60b6b12df45580619a5a56981b0a1ed /content/browser/download/download_item.h
parent2ef498fa1e483669eb2d938aa07e450f5f868708 (diff)
downloadchromium_src-8a282714107a45d1341265f18774264fe02de77b.zip
chromium_src-8a282714107a45d1341265f18774264fe02de77b.tar.gz
chromium_src-8a282714107a45d1341265f18774264fe02de77b.tar.bz2
Remove extensions code from download code. The delegate and other users in Chrome can always figure out when a download is for an extension install, instead of storing this data in DownloadItem. I added two new methods to the delegate to allow it to override opening the download item, which allows the chrome layer to install the crx when it completes or is opened.
BUG=82782 Review URL: http://codereview.chromium.org/7685046 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@97899 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/download/download_item.h')
-rw-r--r--content/browser/download/download_item.h32
1 files changed, 7 insertions, 25 deletions
diff --git a/content/browser/download/download_item.h b/content/browser/download/download_item.h
index 5b2ae0a..40fdfb2 100644
--- a/content/browser/download/download_item.h
+++ b/content/browser/download/download_item.h
@@ -27,11 +27,8 @@
#include "base/timer.h"
#include "content/browser/download/download_request_handle.h"
#include "content/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;
@@ -42,7 +39,7 @@ struct DownloadPersistentStoreInfo;
// Destination tab's download view, may refer to a given DownloadItem.
//
// This is intended to be used only on the UI thread.
-class DownloadItem : public NotificationObserver {
+class DownloadItem {
public:
enum DownloadState {
// Download is actively progressing.
@@ -135,11 +132,6 @@ class DownloadItem : public NotificationObserver {
// Notifies our observers periodically.
void UpdateObservers();
- // NotificationObserver implementation.
- virtual void Observe(int type,
- const NotificationSource& source,
- const NotificationDetails& details);
-
// Returns true if it is OK to open a folder which this file is inside.
bool CanShowInFolder();
@@ -178,6 +170,10 @@ class DownloadItem : public NotificationObserver {
// to display progress when the DownloadItem should be considered complete.
void MarkAsComplete();
+ // Called by the delegate after it delayed completing the download in
+ // DownloadManagerDelegate::ShouldCompleteDownload.
+ void CompleteDelayedDownload();
+
// Called when all data has been saved. Only has display effects.
void OnAllDataSaved(int64 size);
@@ -298,9 +294,6 @@ class DownloadItem : public NotificationObserver {
return state_info_.prompt_user_for_save_location;
}
bool is_otr() const { return is_otr_; }
- bool is_extension_install() const {
- return state_info_.is_extension_install;
- }
const FilePath& suggested_path() const { return state_info_.suggested_path; }
bool is_temporary() const { return is_temporary_; }
void set_opened(bool opened) { opened_ = opened; }
@@ -329,13 +322,6 @@ class DownloadItem : public NotificationObserver {
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
@@ -359,10 +345,6 @@ class DownloadItem : public NotificationObserver {
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();
-
// Call to transition state; all state transitions should go through this.
void TransitionTo(DownloadState new_state);
@@ -485,8 +467,8 @@ class DownloadItem : public NotificationObserver {
// only.
bool open_enabled_;
- // DownloadItem observes CRX installs it initiates.
- NotificationRegistrar registrar_;
+ // Did the delegate delay calling Complete on this download?
+ bool delegate_delayed_complete_;
DISALLOW_COPY_AND_ASSIGN(DownloadItem);
};