diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-14 20:08:20 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-14 20:08:20 +0000 |
commit | 113a42f3a036c484702554d78568ce1bc30d9384 (patch) | |
tree | 676b24db889f6565f3e2242a371d23304e19545c /chrome/browser/views | |
parent | 5dc21090414efa5635c57c94e9c647f819dccfec (diff) | |
download | chromium_src-113a42f3a036c484702554d78568ce1bc30d9384.zip chromium_src-113a42f3a036c484702554d78568ce1bc30d9384.tar.gz chromium_src-113a42f3a036c484702554d78568ce1bc30d9384.tar.bz2 |
Add download item tooltips on linux/win.
BUG=41195
TEST=manual
Review URL: http://codereview.chromium.org/1528032
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44524 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views')
-rw-r--r-- | chrome/browser/views/download_item_view.cc | 12 | ||||
-rw-r--r-- | chrome/browser/views/download_item_view.h | 5 |
2 files changed, 17 insertions, 0 deletions
diff --git a/chrome/browser/views/download_item_view.cc b/chrome/browser/views/download_item_view.cc index 3127813..fbb0dd8 100644 --- a/chrome/browser/views/download_item_view.cc +++ b/chrome/browser/views/download_item_view.cc @@ -211,6 +211,7 @@ DownloadItemView::DownloadItemView(DownloadItem* download, dangerous_mode_body_image_set_ = dangerous_mode_body_image_set; LoadIcon(); + tooltip_text_ = download_->GetFileName().value(); font_ = ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::BaseFont); box_height_ = std::max<int>(2 * kVerticalPadding + font_.height() + @@ -240,6 +241,7 @@ DownloadItemView::DownloadItemView(DownloadItem* download, drop_hover_animation_.reset(new SlideAnimation(this)); if (download->safety_state() == DownloadItem::DANGEROUS) { + tooltip_text_.clear(); body_state_ = DANGEROUS; drop_down_state_ = DANGEROUS; @@ -728,6 +730,7 @@ void DownloadItemView::ClearDangerousMode() { // We need to load the icon now that the download_ has the real path. LoadIcon(); + tooltip_text_ = download_->GetFileName().value(); // Force the shelf to layout again as our size has changed. parent_->Layout(); @@ -924,6 +927,15 @@ void DownloadItemView::LoadIcon() { NewCallback(this, &DownloadItemView::OnExtractIconComplete)); } +bool DownloadItemView::GetTooltipText(const gfx::Point& p, + std::wstring* tooltip) { + if (tooltip_text_.empty()) + return false; + + tooltip->assign(tooltip_text_); + return true; +} + gfx::Size DownloadItemView::GetButtonSize() { DCHECK(save_button_ && discard_button_); gfx::Size size; diff --git a/chrome/browser/views/download_item_view.h b/chrome/browser/views/download_item_view.h index 4c1526c..366dc1c 100644 --- a/chrome/browser/views/download_item_view.h +++ b/chrome/browser/views/download_item_view.h @@ -114,6 +114,8 @@ class DownloadItemView : public views::ButtonListener, void LoadIcon(); + virtual bool GetTooltipText(const gfx::Point& p, std::wstring* tooltip); + // Convenience method to paint the 3 vertical bitmaps (bottom, middle, top) // that form the background. void PaintBitmaps(gfx::Canvas* canvas, @@ -176,6 +178,9 @@ class DownloadItemView : public views::ButtonListener, // The font used to print the file name and status. gfx::Font font_; + // The tooltip. + std::wstring tooltip_text_; + // The current state (normal, hot or pushed) of the body and drop-down. State body_state_; State drop_down_state_; |