Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(968)

Unified Diff: chrome/browser/download/download_item_model.cc

Issue 11640007: Make the UI an observer of downloads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Android clang build Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/download/download_item_model.h ('k') | chrome/browser/download/download_service.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « chrome/browser/download/download_item_model.h ('k') | chrome/browser/download/download_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698