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

Unified Diff: chrome/browser/cocoa/download_item_controller.mm

Issue 380002: Mac: Show download item menu on mouse down instead of mouse up. (Closed)
Patch Set: comments Created 10 years, 11 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/cocoa/download_item_controller.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/cocoa/download_item_controller.mm
diff --git a/chrome/browser/cocoa/download_item_controller.mm b/chrome/browser/cocoa/download_item_controller.mm
index b2ff7ff84d6a873fbd04a60bfbb23f5a2d18a052..a00313cf2d1ee8e2a873115afd95840cc18703f7 100644
--- a/chrome/browser/cocoa/download_item_controller.mm
+++ b/chrome/browser/cocoa/download_item_controller.mm
@@ -100,11 +100,14 @@ class DownloadShelfContextMenuMac : public DownloadShelfContextMenu {
- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
+ [progressView_ setController:nil];
[[self view] removeFromSuperview];
[super dealloc];
}
- (void)awakeFromNib {
+ [progressView_ setController:self];
+
[self setStateFromDownload:bridge_->download_model()];
GTMUILocalizerAndLayoutTweaker* localizerAndLayoutTweaker =
@@ -164,13 +167,12 @@ class DownloadShelfContextMenuMac : public DownloadShelfContextMenu {
// Set correct popup menu. Also, set draggable download on completion.
if (downloadModel->download()->state() == DownloadItem::COMPLETE) {
- currentMenu_ = completeDownloadMenu_;
+ [progressView_ setMenu:completeDownloadMenu_];
[progressView_ setDownload:downloadModel->download()->full_path()];
} else {
- currentMenu_ = activeDownloadMenu_;
+ [progressView_ setMenu:activeDownloadMenu_];
}
- [progressView_ setMenu:currentMenu_]; // for context menu
[cell_ setStateFromDownload:downloadModel];
}
@@ -195,20 +197,11 @@ class DownloadShelfContextMenuMac : public DownloadShelfContextMenu {
}
- (IBAction)handleButtonClick:(id)sender {
- if ([cell_ isButtonPartPressed]) {
- DownloadItem* download = bridge_->download_model()->download();
- if (download->state() == DownloadItem::IN_PROGRESS)
- download->set_open_when_complete(!download->open_when_complete());
- else if (download->state() == DownloadItem::COMPLETE)
- download_util::OpenDownload(download);
- } else {
- // Hold a reference to ourselves in case the download completes and we
- // represent a file that's auto-removed (e.g. a theme).
- scoped_nsobject<DownloadItemController> ref([self retain]);
- [NSMenu popUpContextMenu:currentMenu_
- withEvent:[NSApp currentEvent]
- forView:progressView_];
- }
+ DownloadItem* download = bridge_->download_model()->download();
+ if (download->state() == DownloadItem::IN_PROGRESS)
+ download->set_open_when_complete(!download->open_when_complete());
+ else if (download->state() == DownloadItem::COMPLETE)
+ download_util::OpenDownload(download);
}
- (NSSize)preferredSize {
« no previous file with comments | « chrome/browser/cocoa/download_item_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698