summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/cocoa/download_item_controller.h5
-rw-r--r--chrome/browser/cocoa/download_item_controller.mm12
-rw-r--r--chrome/browser/cocoa/download_item_mac.mm4
3 files changed, 19 insertions, 2 deletions
diff --git a/chrome/browser/cocoa/download_item_controller.h b/chrome/browser/cocoa/download_item_controller.h
index 7d7b769..3cf6c8e 100644
--- a/chrome/browser/cocoa/download_item_controller.h
+++ b/chrome/browser/cocoa/download_item_controller.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -86,6 +86,9 @@ class DownloadShelfContextMenuMac;
// Returns the DownloadItem model object belonging to this item.
- (DownloadItem*)download;
+// Updates the tooltip with the download's path.
+- (void)updateToolTip;
+
// Handling of dangerous downloads
- (void)clearDangerousMode;
- (BOOL)isDangerousMode;
diff --git a/chrome/browser/cocoa/download_item_controller.mm b/chrome/browser/cocoa/download_item_controller.mm
index 02dcd660..ccc2770 100644
--- a/chrome/browser/cocoa/download_item_controller.mm
+++ b/chrome/browser/cocoa/download_item_controller.mm
@@ -36,6 +36,10 @@ const int kTextWidth = 140; // Pixels
// dangerous download message.
const int kFileNameMaxLength = 20;
+// The maximum width in pixels for the file name tooltip.
+const int kToolTipMaxWidth = 900;
+
+
// Helper to widen a view.
void WidenView(NSView* view, CGFloat widthChange) {
// If it is an NSBox, the autoresize of the contentView is the issue.
@@ -150,6 +154,7 @@ class DownloadShelfContextMenuMac : public DownloadShelfContextMenu {
[image_ setImage:alertIcon];
bridge_->LoadIcon();
+ [self updateToolTip];
}
- (void)setStateFromDownload:(BaseDownloadItemModel*)downloadModel {
@@ -254,6 +259,13 @@ class DownloadShelfContextMenuMac : public DownloadShelfContextMenu {
return bridge_->download_model()->download();
}
+- (void)updateToolTip {
+ std::wstring elidedFilename = gfx::ElideFilename(
+ [self download]->GetFileName(),
+ gfx::Font(), kToolTipMaxWidth);
+ [progressView_ setToolTip:base::SysWideToNSString(elidedFilename)];
+}
+
- (void)clearDangerousMode {
[self setState:kNormal];
// The state change hide the dangerouse download view and is now showing the
diff --git a/chrome/browser/cocoa/download_item_mac.mm b/chrome/browser/cocoa/download_item_mac.mm
index 144b42d..7bc3b25 100644
--- a/chrome/browser/cocoa/download_item_mac.mm
+++ b/chrome/browser/cocoa/download_item_mac.mm
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -39,6 +39,8 @@ void DownloadItemMac::OnDownloadUpdated(DownloadItem* download) {
// another thread, so reload the icon if the download filename changes.
LoadIcon();
lastFilePath_ = download->full_path();
+
+ [item_controller_ updateToolTip];
}
switch (download->state()) {