Index: chrome/browser/download/download_item_model.cc |
diff --git a/chrome/browser/download/download_item_model.cc b/chrome/browser/download/download_item_model.cc |
index 192971f32cd06529b35b5cd1833198c690960893..78516f996dd5786d0a3d9b769d76972867df537b 100644 |
--- a/chrome/browser/download/download_item_model.cc |
+++ b/chrome/browser/download/download_item_model.cc |
@@ -45,6 +45,11 @@ class DownloadItemModelData : public base::SupportsUserData::Data { |
should_show_in_shelf_ = should_show_in_shelf; |
} |
+ bool should_notify_ui() const { return should_notify_ui_; } |
+ void set_should_notify_ui(bool should_notify_ui) { |
+ should_notify_ui_ = should_notify_ui; |
+ } |
+ |
private: |
DownloadItemModelData(); |
virtual ~DownloadItemModelData() {} |
@@ -54,6 +59,10 @@ class DownloadItemModelData : public base::SupportsUserData::Data { |
// Whether the download should be displayed in the download shelf. True by |
// default. |
bool should_show_in_shelf_; |
+ |
+ // Whether the UI should be notified when the download is ready to be |
+ // presented. |
+ bool should_notify_ui_; |
}; |
// static |
@@ -78,7 +87,8 @@ DownloadItemModelData* DownloadItemModelData::GetOrCreate( |
} |
DownloadItemModelData::DownloadItemModelData() |
- : should_show_in_shelf_(true) { |
+ : should_show_in_shelf_(true), |
+ should_notify_ui_(false) { |
} |
string16 InterruptReasonStatusMessage(int reason) { |
@@ -422,6 +432,16 @@ void DownloadItemModel::SetShouldShowInShelf(bool should_show) { |
data->set_should_show_in_shelf(should_show); |
} |
+bool DownloadItemModel::ShouldNotifyUI() const { |
+ const DownloadItemModelData* data = DownloadItemModelData::Get(download_); |
+ return data && data->should_notify_ui(); |
+} |
+ |
+void DownloadItemModel::SetShouldNotifyUI(bool should_notify) { |
+ DownloadItemModelData* data = DownloadItemModelData::GetOrCreate(download_); |
+ data->set_should_notify_ui(should_notify); |
+} |
+ |
string16 DownloadItemModel::GetProgressSizesString() const { |
string16 size_ratio; |
int64 size = GetCompletedBytes(); |