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

Unified Diff: chrome/browser/views/download_item_view.cc

Issue 1528032: Add download item tooltips on linux/win. (Closed)
Patch Set: fix compile Created 10 years, 8 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/views/download_item_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/views/download_item_view.cc
diff --git a/chrome/browser/views/download_item_view.cc b/chrome/browser/views/download_item_view.cc
index 31278130c9634082c173489be7f8beb91dbc2c4e..fbb0dd84d62af2c731b433636756679a92db0057 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;
« no previous file with comments | « chrome/browser/views/download_item_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698