diff options
author | ahendrickson@chromium.org <ahendrickson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-23 19:15:01 +0000 |
---|---|---|
committer | ahendrickson@chromium.org <ahendrickson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-23 19:15:01 +0000 |
commit | 4cd82f72da57dac8a4b810d8a99fbe5b379cf593 (patch) | |
tree | 5c503dfa4605672086765819a2af1ab9f669dd2e /chrome/browser/ui/gtk | |
parent | 088e6a3814c7de976650e8ad2b5cb075656d8665 (diff) | |
download | chromium_src-4cd82f72da57dac8a4b810d8a99fbe5b379cf593.zip chromium_src-4cd82f72da57dac8a4b810d8a99fbe5b379cf593.tar.gz chromium_src-4cd82f72da57dac8a4b810d8a99fbe5b379cf593.tar.bz2 |
Part 2 of downloads data flow refactor.
Reduced the lifetime of DownloadCreateInfo.
DownloadCreateInfo now only lives until DownloadFileManager::CreateDownloadFile(). It's contents are put into DownloadItem, and then only the download ID is passed around to get at the information.
In addition, most of DownloadItem's members are grouped into sub-structures by functionality:
- history_
Passed to the history data base, and includes the data relevant to that.
- request_
Contains the information about the request, which is not present in the other structures.
- state_
Contains data that is used to manage the download process. It is part of DownloadItem because it is specific to that item, but it could instead be passed around as an extra parameter.
Some notes on the refactoring:
- DownloadItem is only accessed in the UI thread. This means that the state_ structure needs to be passed by value to DownloadManager::CheckIfSuggestedPathExists(), modified there, and then passed by value again to DownloadManager::OnPathExistenceAvailable(), where it is copied bach into DownloadItem.
BUG=78084,77188
TEST=Passes all download unit tests.
Review URL: http://codereview.chromium.org/6969009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86319 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/gtk')
-rw-r--r-- | chrome/browser/ui/gtk/download/download_item_gtk.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/chrome/browser/ui/gtk/download/download_item_gtk.cc b/chrome/browser/ui/gtk/download/download_item_gtk.cc index 71c5601..25c94e8 100644 --- a/chrome/browser/ui/gtk/download/download_item_gtk.cc +++ b/chrome/browser/ui/gtk/download/download_item_gtk.cc @@ -533,13 +533,14 @@ void DownloadItemGtk::UpdateDangerWarning() { string16 dangerous_warning; // The dangerous download label text is different for different cases. - if (get_download()->danger_type() == DownloadItem::DANGEROUS_URL) { + if (get_download()->GetDangerType() == DownloadItem::DANGEROUS_URL) { // Safebrowsing shows the download URL leads to malicious file. dangerous_warning = l10n_util::GetStringUTF16(IDS_PROMPT_UNSAFE_DOWNLOAD_URL); } else { // It's a dangerous file type (e.g.: an executable). - DCHECK(get_download()->danger_type() == DownloadItem::DANGEROUS_FILE); + DCHECK(get_download()->GetDangerType() == + DownloadItem::DANGEROUS_FILE); if (get_download()->is_extension_install()) { dangerous_warning = l10n_util::GetStringUTF16(IDS_PROMPT_DANGEROUS_DOWNLOAD_EXTENSION); @@ -589,7 +590,7 @@ void DownloadItemGtk::UpdateDangerWarning() { void DownloadItemGtk::UpdateDangerIcon() { if (theme_service_->UsingNativeTheme()) { const char* stock = - get_download()->danger_type() == DownloadItem::DANGEROUS_URL ? + get_download()->GetDangerType() == DownloadItem::DANGEROUS_URL ? GTK_STOCK_DIALOG_ERROR : GTK_STOCK_DIALOG_WARNING; gtk_image_set_from_stock( GTK_IMAGE(dangerous_image_), stock, GTK_ICON_SIZE_SMALL_TOOLBAR); @@ -597,7 +598,7 @@ void DownloadItemGtk::UpdateDangerIcon() { // Set the warning icon. ResourceBundle& rb = ResourceBundle::GetSharedInstance(); int pixbuf_id = - get_download()->danger_type() == DownloadItem::DANGEROUS_URL ? + get_download()->GetDangerType() == DownloadItem::DANGEROUS_URL ? IDR_SAFEBROWSING_WARNING : IDR_WARNING; GdkPixbuf* download_pixbuf = rb.GetNativeImageNamed(pixbuf_id); gtk_image_set_from_pixbuf(GTK_IMAGE(dangerous_image_), download_pixbuf); |