summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/download_item_view.cc
diff options
context:
space:
mode:
authorglen@chromium.org <glen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-15 20:34:28 +0000
committerglen@chromium.org <glen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-15 20:34:28 +0000
commit0aad67b662f0ba306eeea71117d77bccefc3533f (patch)
tree15b7c9c336fe192fe4b20561b250bc614f2ef800 /chrome/browser/views/download_item_view.cc
parenta754453c13d397bb9b49a0bbb61e276fa0190365 (diff)
downloadchromium_src-0aad67b662f0ba306eeea71117d77bccefc3533f.zip
chromium_src-0aad67b662f0ba306eeea71117d77bccefc3533f.tar.gz
chromium_src-0aad67b662f0ba306eeea71117d77bccefc3533f.tar.bz2
Remove auto-open items from the download shelf on auto-open. This has the delicious side-effect of auto-closing the download shelf after extensions are downloaded and auto installed.
While we're here, also add proper colors to the download buttons. BUG=16232 TEST=Install a theme from the web, make sure the download shelf isn't shown after installation. Do the same for a filetype that is set to auto-open. Make sure the shelf stays open for other filetypes. Review URL: http://codereview.chromium.org/149580 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20787 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/download_item_view.cc')
-rw-r--r--chrome/browser/views/download_item_view.cc16
1 files changed, 12 insertions, 4 deletions
diff --git a/chrome/browser/views/download_item_view.cc b/chrome/browser/views/download_item_view.cc
index fcf832b..7ad4847 100644
--- a/chrome/browser/views/download_item_view.cc
+++ b/chrome/browser/views/download_item_view.cc
@@ -10,10 +10,12 @@
#include "app/gfx/text_elider.h"
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
+#include "app/theme_provider.h"
#include "base/file_path.h"
#include "base/string_util.h"
#include "base/sys_string_conversions.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/browser_theme_provider.h"
#include "chrome/browser/download/download_item_model.h"
#include "chrome/browser/download/download_util.h"
#include "chrome/browser/views/download_shelf_view.h"
@@ -55,7 +57,6 @@ static const int kButtonPadding = 5; // Pixels.
// The space on the left and right side of the dangerous download label.
static const int kLabelPadding = 4; // Pixels.
-static const SkColor kFileNameColor = SkColorSetRGB(87, 108, 149);
static const SkColor kFileNameDisabledColor = SkColorSetRGB(171, 192, 212);
static const SkColor kStatusColor = SkColorSetRGB(123, 141, 174);
@@ -305,7 +306,8 @@ DownloadItemView::DownloadItemView(DownloadItem* download,
dangerous_download_label_->SetMultiLine(true);
dangerous_download_label_->SetHorizontalAlignment(
views::Label::ALIGN_LEFT);
- dangerous_download_label_->SetColor(kFileNameColor);
+ dangerous_download_label_->SetColor(GetThemeProvider()->GetColor(
+ BrowserThemeProvider::COLOR_BOOKMARK_TEXT));
AddChildView(dangerous_download_label_);
SizeLabelToMinWidth();
}
@@ -360,6 +362,10 @@ void DownloadItemView::OnDownloadUpdated(DownloadItem* download) {
download_->is_paused() ? StopDownloadProgress() : StartDownloadProgress();
break;
case DownloadItem::COMPLETE:
+ if (download_->auto_opened()) {
+ parent_->RemoveDownloadView(this); // This will delete us!
+ return;
+ }
StopDownloadProgress();
complete_animation_.reset(new SlideAnimation(this));
complete_animation_->SetSlideDuration(kCompleteAnimationDurationMs);
@@ -596,12 +602,14 @@ void DownloadItemView::Paint(gfx::Canvas* canvas) {
int mirrored_x = MirroredXWithWidthInsideView(
download_util::kSmallProgressIconSize, kTextWidth);
+ SkColor file_name_color = GetThemeProvider()->GetColor(
+ BrowserThemeProvider::COLOR_BOOKMARK_TEXT);
if (show_status_text_) {
int y = box_y_ + kVerticalPadding;
// Draw the file's name.
canvas->DrawStringInt(filename, font_,
- IsEnabled() ? kFileNameColor :
+ IsEnabled() ? file_name_color :
kFileNameDisabledColor,
mirrored_x, y, kTextWidth, font_.height());
@@ -614,7 +622,7 @@ void DownloadItemView::Paint(gfx::Canvas* canvas) {
// Draw the file's name.
canvas->DrawStringInt(filename, font_,
- IsEnabled() ? kFileNameColor :
+ IsEnabled() ? file_name_color :
kFileNameDisabledColor,
mirrored_x, y, kTextWidth, font_.height());
}