| 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/cocoa/download_item_controller.h" | 5 #import "chrome/browser/cocoa/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/histogram.h" | 10 #include "base/histogram.h" |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 | 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 | 240 // the partial visible one with a horizontal alpha gradient -- crbug.com/17830 |
| 241 NSView* view = [self view]; | 241 NSView* view = [self view]; |
| 242 NSRect containerFrame = [[view superview] frame]; | 242 NSRect containerFrame = [[view superview] frame]; |
| 243 [view setHidden:(NSMaxX([view frame]) > NSWidth(containerFrame))]; | 243 [view setHidden:(NSMaxX([view frame]) > NSWidth(containerFrame))]; |
| 244 } | 244 } |
| 245 | 245 |
| 246 - (void)downloadWasOpened { |
| 247 [shelf_ downloadWasOpened:self]; |
| 248 } |
| 249 |
| 246 - (IBAction)handleButtonClick:(id)sender { | 250 - (IBAction)handleButtonClick:(id)sender { |
| 247 DownloadItem* download = bridge_->download_model()->download(); | 251 DownloadItem* download = bridge_->download_model()->download(); |
| 248 download->OpenDownload(); | 252 download->OpenDownload(); |
| 249 } | 253 } |
| 250 | 254 |
| 251 - (NSSize)preferredSize { | 255 - (NSSize)preferredSize { |
| 252 if (state_ == kNormal) | 256 if (state_ == kNormal) |
| 253 return [progressView_ frame].size; | 257 return [progressView_ frame].size; |
| 254 DCHECK_EQ(kDangerous, state_); | 258 DCHECK_EQ(kDangerous, state_); |
| 255 return [dangerousDownloadView_ frame].size; | 259 return [dangerousDownloadView_ frame].size; |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 [sender setTitle:l10n_util::GetNSStringWithFixup( | 387 [sender setTitle:l10n_util::GetNSStringWithFixup( |
| 384 IDS_DOWNLOAD_MENU_PAUSE_ITEM)]; | 388 IDS_DOWNLOAD_MENU_PAUSE_ITEM)]; |
| 385 } else { | 389 } else { |
| 386 [sender setTitle:l10n_util::GetNSStringWithFixup( | 390 [sender setTitle:l10n_util::GetNSStringWithFixup( |
| 387 IDS_DOWNLOAD_MENU_RESUME_ITEM)]; | 391 IDS_DOWNLOAD_MENU_RESUME_ITEM)]; |
| 388 } | 392 } |
| 389 menuBridge_->ExecuteCommand(DownloadShelfContextMenuMac::TOGGLE_PAUSE); | 393 menuBridge_->ExecuteCommand(DownloadShelfContextMenuMac::TOGGLE_PAUSE); |
| 390 } | 394 } |
| 391 | 395 |
| 392 @end | 396 @end |
| OLD | NEW |