From aa3a6a233b25e5a9eab46deccedb641049f6b773 Mon Sep 17 00:00:00 2001 From: "thakis@chromium.org" Date: Wed, 30 Dec 2009 18:57:38 +0000 Subject: Added pause button to DownloadItemMac via IB and IBAction to receive the event. BUG=23069 TEST=Download large file, click pause in download item's menu to pause/unpause. Review URL: http://codereview.chromium.org/524009 Patch from sig11@reprehensible.net. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35384 0039d316-1c4b-4281-b951-d872f2087c98 --- AUTHORS | 1 + chrome/app/nibs/DownloadItem.xib | 797 +++++++++++++++++++++-- chrome/browser/cocoa/download_item_controller.h | 1 + chrome/browser/cocoa/download_item_controller.mm | 7 + 4 files changed, 767 insertions(+), 39 deletions(-) diff --git a/AUTHORS b/AUTHORS index 30ef599..d840494 100644 --- a/AUTHORS +++ b/AUTHORS @@ -57,3 +57,4 @@ Ramkumar Ramachandra Dominic Jodoin Kaspar Brand Clemens Fruhwirth +Kevin Lee Helpingstine diff --git a/chrome/app/nibs/DownloadItem.xib b/chrome/app/nibs/DownloadItem.xib index ec6c888..f964e42 100644 --- a/chrome/app/nibs/DownloadItem.xib +++ b/chrome/app/nibs/DownloadItem.xib @@ -1,16 +1,20 @@ - + 1050 - 9L31a - 677 - 949.54 - 353.00 + 10C540 + 732 + 1038.25 + 458.00 + + com.apple.InterfaceBuilder.CocoaPlugin + 732 + YES - - + + YES @@ -18,7 +22,7 @@ YES - + YES @@ -63,7 +67,7 @@ some placeholder text to make layout easier in Interface Builder LucidaGrande - 9.000000e+00 + 9 3614 @@ -73,7 +77,7 @@ controlColor 3 - MC42NjY2NjY2OQA + MC42NjY2NjY2NjY3AA @@ -92,7 +96,7 @@ 292 YES - + YES Apple PDF pasteboard type Apple PICT pasteboard type @@ -110,7 +114,7 @@ 33685504 LucidaGrande - 1.100000e+01 + 11 3100 0 @@ -215,7 +219,7 @@ Button LucidaGrande - 1.300000e+01 + 13 1044 @@ -338,6 +342,14 @@ + + + ^IDS_DOWNLOAD_MENU_PAUSE_ITEM + + 2147483647 + + + ^IDS_DOWNLOAD_MENU_SHOW @@ -569,34 +581,40 @@ 99 + + + handleTogglePause: + + + + 102 + YES 0 - - YES - + -2 - - RmlsZSdzIE93bmVyA + + File's Owner -1 - + First Responder -3 - + Application @@ -607,7 +625,7 @@ - + 13 @@ -621,7 +639,7 @@ - + 14 @@ -664,8 +682,9 @@ + - + 25 @@ -791,13 +810,18 @@ 83 - + + + + 100 + + YES - + YES -1.IBPluginDependency -2.IBPluginDependency @@ -806,6 +830,7 @@ 1.IBPluginDependency 1.WindowOrigin 1.editorWindowContentRectSynchronizationRect + 100.IBPluginDependency 13.IBEditorWindowLastContentRect 13.IBPluginDependency 14.IBPluginDependency @@ -843,19 +868,20 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{276, 710}, {440, 34}} + {{459, 785}, {440, 34}} com.apple.InterfaceBuilder.CocoaPlugin {628, 654} {{357, 416}, {480, 272}} - {{47, 650}, {382, 103}} com.apple.InterfaceBuilder.CocoaPlugin + {{2, 656}, {379, 103}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{42, 490}, {406, 103}} + com.apple.InterfaceBuilder.CocoaPlugin + {{3, 473}, {403, 123}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -884,9 +910,7 @@ YES - - YES - + YES @@ -894,15 +918,13 @@ YES - - YES - + YES - 99 + 102 @@ -928,7 +950,7 @@ NSViewController YES - + YES discardDownload: handleAlwaysOpen: @@ -936,6 +958,7 @@ handleCancel: handleOpen: handleReveal: + handleTogglePause: saveDownload: updateVisibility: @@ -949,11 +972,12 @@ id id id + id YES - + YES activeDownloadMenu_ buttonTweaker_ @@ -990,7 +1014,7 @@ NSObject YES - + YES otherObjectToLocalize_ owner_ @@ -1013,7 +1037,7 @@ NSView YES - + YES viewToResize_ viewToSlideAndResize_ @@ -1061,8 +1085,703 @@ + + YES + + NSActionCell + NSCell + + IBFrameworkSource + AppKit.framework/Headers/NSActionCell.h + + + + NSApplication + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSApplication.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSApplicationScripting.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSColorPanel.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSHelpManager.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSPageLayout.h + + + + NSBox + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSBox.h + + + + NSButton + NSControl + + IBFrameworkSource + AppKit.framework/Headers/NSButton.h + + + + NSButtonCell + NSActionCell + + IBFrameworkSource + AppKit.framework/Headers/NSButtonCell.h + + + + NSCell + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSCell.h + + + + NSControl + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSControl.h + + + + NSFormatter + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFormatter.h + + + + NSImageCell + NSCell + + IBFrameworkSource + AppKit.framework/Headers/NSImageCell.h + + + + NSImageView + NSControl + + IBFrameworkSource + AppKit.framework/Headers/NSImageView.h + + + + NSMenu + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSMenu.h + + + + NSMenuItem + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSMenuItem.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSAccessibility.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSAlert.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSAnimation.h + + + + NSObject + + + + NSObject + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSBrowser.h + + + + NSObject + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSComboBox.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSComboBoxCell.h + + + + NSObject + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSDatePickerCell.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSDictionaryController.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSDragging.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSDrawer.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSFontManager.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSFontPanel.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSImage.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSKeyValueBinding.h + + + + NSObject + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSNibLoading.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSOutlineView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSPasteboard.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSRuleEditor.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSSavePanel.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSSound.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSSpeechRecognizer.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSSpeechSynthesizer.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSSplitView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSTabView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSTableView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSText.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSTextStorage.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSTextView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSTokenField.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSTokenFieldCell.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSToolbar.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSToolbarItem.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSWindow.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSClassDescription.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSConnection.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSError.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFileManager.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueObserving.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyedArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSMetadata.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSNetServices.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObject.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObjectScripting.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSPort.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSPortCoder.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSRunLoop.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptClassDescription.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptObjectSpecifiers.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptWhoseTests.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSSpellServer.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSStream.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSThread.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURL.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLConnection.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLDownload.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSXMLParser.h + + + + NSObject + + IBFrameworkSource + Print.framework/Headers/PDEPluginInterface.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CAAnimation.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CALayer.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CIImageProvider.h + + + + NSObject + + IBFrameworkSource + SecurityInterface.framework/Headers/SFAuthorizationView.h + + + + NSObject + + IBFrameworkSource + SecurityInterface.framework/Headers/SFCertificatePanel.h + + + + NSObject + + IBFrameworkSource + SecurityInterface.framework/Headers/SFChooseIdentityPanel.h + + + + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSInterfaceStyle.h + + + + NSResponder + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSResponder.h + + + + NSTextField + NSControl + + IBFrameworkSource + AppKit.framework/Headers/NSTextField.h + + + + NSTextFieldCell + NSActionCell + + IBFrameworkSource + AppKit.framework/Headers/NSTextFieldCell.h + + + + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSClipView.h + + + + NSView + + + + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSRulerView.h + + + + NSView + NSResponder + + + + NSViewController + NSResponder + + view + NSView + + + IBFrameworkSource + AppKit.framework/Headers/NSViewController.h + + + 0 + + com.apple.InterfaceBuilder.CocoaPlugin.macosx + + + + com.apple.InterfaceBuilder.CocoaPlugin.macosx + + + + com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 + + + YES ../../chrome.xcodeproj 3 diff --git a/chrome/browser/cocoa/download_item_controller.h b/chrome/browser/cocoa/download_item_controller.h index 463d580..287d61c 100644 --- a/chrome/browser/cocoa/download_item_controller.h +++ b/chrome/browser/cocoa/download_item_controller.h @@ -98,6 +98,7 @@ class DownloadShelfContextMenuMac; - (IBAction)handleAlwaysOpen:(id)sender; - (IBAction)handleReveal:(id)sender; - (IBAction)handleCancel:(id)sender; +- (IBAction)handleTogglePause:(id)sender; @end diff --git a/chrome/browser/cocoa/download_item_controller.mm b/chrome/browser/cocoa/download_item_controller.mm index 35c3bea..9e1651b 100644 --- a/chrome/browser/cocoa/download_item_controller.mm +++ b/chrome/browser/cocoa/download_item_controller.mm @@ -63,6 +63,7 @@ class DownloadShelfContextMenuMac : public DownloadShelfContextMenu { using DownloadShelfContextMenu::OPEN_WHEN_COMPLETE; using DownloadShelfContextMenu::ALWAYS_OPEN_TYPE; using DownloadShelfContextMenu::CANCEL; + using DownloadShelfContextMenu::TOGGLE_PAUSE; }; @interface DownloadItemController (Private) @@ -291,6 +292,8 @@ class DownloadShelfContextMenuMac : public DownloadShelfContextMenu { actionId = DownloadShelfContextMenuMac::SHOW_IN_FOLDER; } else if (action == @selector(handleCancel:)) { actionId = DownloadShelfContextMenuMac::CANCEL; + } else if (action == @selector(handleTogglePause:)) { + actionId = DownloadShelfContextMenuMac::TOGGLE_PAUSE; } else { NOTREACHED(); return YES; @@ -322,4 +325,8 @@ class DownloadShelfContextMenuMac : public DownloadShelfContextMenu { menuBridge_->ExecuteItemCommand(DownloadShelfContextMenuMac::CANCEL); } +- (IBAction)handleTogglePause:(id)sender { + menuBridge_->ExecuteItemCommand(DownloadShelfContextMenuMac::TOGGLE_PAUSE); +} + @end -- cgit v1.1