| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/gfx/text_elider.h" | 7 #include "app/gfx/text_elider.h" |
| 8 #include "app/l10n_util_mac.h" | 8 #include "app/l10n_util_mac.h" |
| 9 #include "app/resource_bundle.h" | 9 #include "app/resource_bundle.h" |
| 10 #include "base/mac_util.h" | 10 #include "base/mac_util.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 : DownloadShelfContextMenu(model) { } | 56 : DownloadShelfContextMenu(model) { } |
| 57 | 57 |
| 58 using DownloadShelfContextMenu::ExecuteItemCommand; | 58 using DownloadShelfContextMenu::ExecuteItemCommand; |
| 59 using DownloadShelfContextMenu::ItemIsChecked; | 59 using DownloadShelfContextMenu::ItemIsChecked; |
| 60 using DownloadShelfContextMenu::IsItemCommandEnabled; | 60 using DownloadShelfContextMenu::IsItemCommandEnabled; |
| 61 | 61 |
| 62 using DownloadShelfContextMenu::SHOW_IN_FOLDER; | 62 using DownloadShelfContextMenu::SHOW_IN_FOLDER; |
| 63 using DownloadShelfContextMenu::OPEN_WHEN_COMPLETE; | 63 using DownloadShelfContextMenu::OPEN_WHEN_COMPLETE; |
| 64 using DownloadShelfContextMenu::ALWAYS_OPEN_TYPE; | 64 using DownloadShelfContextMenu::ALWAYS_OPEN_TYPE; |
| 65 using DownloadShelfContextMenu::CANCEL; | 65 using DownloadShelfContextMenu::CANCEL; |
| 66 using DownloadShelfContextMenu::TOGGLE_PAUSE; |
| 66 }; | 67 }; |
| 67 | 68 |
| 68 @interface DownloadItemController (Private) | 69 @interface DownloadItemController (Private) |
| 69 - (void)themeDidChangeNotification:(NSNotification*)aNotification; | 70 - (void)themeDidChangeNotification:(NSNotification*)aNotification; |
| 70 - (void)updateTheme:(GTMTheme*)theme; | 71 - (void)updateTheme:(GTMTheme*)theme; |
| 71 - (void)setState:(DownoadItemState)state; | 72 - (void)setState:(DownoadItemState)state; |
| 72 @end | 73 @end |
| 73 | 74 |
| 74 // Implementation of DownloadItemController | 75 // Implementation of DownloadItemController |
| 75 | 76 |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 | 285 |
| 285 int actionId = 0; | 286 int actionId = 0; |
| 286 if (action == @selector(handleOpen:)) { | 287 if (action == @selector(handleOpen:)) { |
| 287 actionId = DownloadShelfContextMenuMac::OPEN_WHEN_COMPLETE; | 288 actionId = DownloadShelfContextMenuMac::OPEN_WHEN_COMPLETE; |
| 288 } else if (action == @selector(handleAlwaysOpen:)) { | 289 } else if (action == @selector(handleAlwaysOpen:)) { |
| 289 actionId = DownloadShelfContextMenuMac::ALWAYS_OPEN_TYPE; | 290 actionId = DownloadShelfContextMenuMac::ALWAYS_OPEN_TYPE; |
| 290 } else if (action == @selector(handleReveal:)) { | 291 } else if (action == @selector(handleReveal:)) { |
| 291 actionId = DownloadShelfContextMenuMac::SHOW_IN_FOLDER; | 292 actionId = DownloadShelfContextMenuMac::SHOW_IN_FOLDER; |
| 292 } else if (action == @selector(handleCancel:)) { | 293 } else if (action == @selector(handleCancel:)) { |
| 293 actionId = DownloadShelfContextMenuMac::CANCEL; | 294 actionId = DownloadShelfContextMenuMac::CANCEL; |
| 295 } else if (action == @selector(handleTogglePause:)) { |
| 296 actionId = DownloadShelfContextMenuMac::TOGGLE_PAUSE; |
| 294 } else { | 297 } else { |
| 295 NOTREACHED(); | 298 NOTREACHED(); |
| 296 return YES; | 299 return YES; |
| 297 } | 300 } |
| 298 | 301 |
| 299 if (menuBridge_->ItemIsChecked(actionId)) | 302 if (menuBridge_->ItemIsChecked(actionId)) |
| 300 [item setState:NSOnState]; | 303 [item setState:NSOnState]; |
| 301 else | 304 else |
| 302 [item setState:NSOffState]; | 305 [item setState:NSOffState]; |
| 303 | 306 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 315 } | 318 } |
| 316 | 319 |
| 317 - (IBAction)handleReveal:(id)sender { | 320 - (IBAction)handleReveal:(id)sender { |
| 318 menuBridge_->ExecuteItemCommand(DownloadShelfContextMenuMac::SHOW_IN_FOLDER); | 321 menuBridge_->ExecuteItemCommand(DownloadShelfContextMenuMac::SHOW_IN_FOLDER); |
| 319 } | 322 } |
| 320 | 323 |
| 321 - (IBAction)handleCancel:(id)sender { | 324 - (IBAction)handleCancel:(id)sender { |
| 322 menuBridge_->ExecuteItemCommand(DownloadShelfContextMenuMac::CANCEL); | 325 menuBridge_->ExecuteItemCommand(DownloadShelfContextMenuMac::CANCEL); |
| 323 } | 326 } |
| 324 | 327 |
| 328 - (IBAction)handleTogglePause:(id)sender { |
| 329 menuBridge_->ExecuteItemCommand(DownloadShelfContextMenuMac::TOGGLE_PAUSE); |
| 330 } |
| 331 |
| 325 @end | 332 @end |
| OLD | NEW |