| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import "chrome/browser/ui/cocoa/download/download_item_controller.h" | 5 #import "chrome/browser/ui/cocoa/download/download_item_controller.h" |
| 6 | 6 |
| 7 #include "app/l10n_util_mac.h" | 7 #include "app/l10n_util_mac.h" |
| 8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
| 9 #include "app/text_elider.h" | 9 #include "app/text_elider.h" |
| 10 #include "base/mac_util.h" | 10 #include "base/mac_util.h" |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 | 229 |
| 230 - (void)remove { | 230 - (void)remove { |
| 231 // We are deleted after this! | 231 // We are deleted after this! |
| 232 [shelf_ remove:self]; | 232 [shelf_ remove:self]; |
| 233 } | 233 } |
| 234 | 234 |
| 235 - (void)updateVisibility:(id)sender { | 235 - (void)updateVisibility:(id)sender { |
| 236 if ([[self view] window]) | 236 if ([[self view] window]) |
| 237 [self updateTheme:[[[self view] window] themeProvider]]; | 237 [self updateTheme:[[[self view] window] themeProvider]]; |
| 238 | 238 |
| 239 // TODO(thakis): Make this prettier, by fading the items out or overlaying | |
| 240 // the partial visible one with a horizontal alpha gradient -- crbug.com/17830 | |
| 241 NSView* view = [self view]; | 239 NSView* view = [self view]; |
| 242 NSRect containerFrame = [[view superview] frame]; | 240 NSRect containerFrame = [[view superview] frame]; |
| 243 [view setHidden:(NSMaxX([view frame]) > NSWidth(containerFrame))]; | 241 [view setHidden:(NSMaxX([view frame]) > NSWidth(containerFrame))]; |
| 244 } | 242 } |
| 245 | 243 |
| 246 - (IBAction)handleButtonClick:(id)sender { | 244 - (IBAction)handleButtonClick:(id)sender { |
| 247 NSEvent* event = [NSApp currentEvent]; | 245 NSEvent* event = [NSApp currentEvent]; |
| 248 if ([event modifierFlags] & NSCommandKeyMask) { | 246 if ([event modifierFlags] & NSCommandKeyMask) { |
| 249 // Let cmd-click show the file in Finder, like e.g. in Safari and Spotlight. | 247 // Let cmd-click show the file in Finder, like e.g. in Safari and Spotlight. |
| 250 menuBridge_->ExecuteCommand(DownloadShelfContextMenuMac::SHOW_IN_FOLDER); | 248 menuBridge_->ExecuteCommand(DownloadShelfContextMenuMac::SHOW_IN_FOLDER); |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 [sender setTitle:l10n_util::GetNSStringWithFixup( | 387 [sender setTitle:l10n_util::GetNSStringWithFixup( |
| 390 IDS_DOWNLOAD_MENU_PAUSE_ITEM)]; | 388 IDS_DOWNLOAD_MENU_PAUSE_ITEM)]; |
| 391 } else { | 389 } else { |
| 392 [sender setTitle:l10n_util::GetNSStringWithFixup( | 390 [sender setTitle:l10n_util::GetNSStringWithFixup( |
| 393 IDS_DOWNLOAD_MENU_RESUME_ITEM)]; | 391 IDS_DOWNLOAD_MENU_RESUME_ITEM)]; |
| 394 } | 392 } |
| 395 menuBridge_->ExecuteCommand(DownloadShelfContextMenuMac::TOGGLE_PAUSE); | 393 menuBridge_->ExecuteCommand(DownloadShelfContextMenuMac::TOGGLE_PAUSE); |
| 396 } | 394 } |
| 397 | 395 |
| 398 @end | 396 @end |
| OLD | NEW |