| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/mac/mac_util.h" | 7 #include "base/mac/mac_util.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/string16.h" | 9 #include "base/string16.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 base::Time::Now() - creationTime_); | 344 base::Time::Now() - creationTime_); |
| 345 // This will change the state and notify us. | 345 // This will change the state and notify us. |
| 346 bridge_->download_model()->download()->DangerousDownloadValidated(); | 346 bridge_->download_model()->download()->DangerousDownloadValidated(); |
| 347 } | 347 } |
| 348 | 348 |
| 349 - (IBAction)discardDownload:(id)sender { | 349 - (IBAction)discardDownload:(id)sender { |
| 350 UMA_HISTOGRAM_LONG_TIMES("clickjacking.discard_download", | 350 UMA_HISTOGRAM_LONG_TIMES("clickjacking.discard_download", |
| 351 base::Time::Now() - creationTime_); | 351 base::Time::Now() - creationTime_); |
| 352 DownloadItem* download = bridge_->download_model()->download(); | 352 DownloadItem* download = bridge_->download_model()->download(); |
| 353 if (download->IsPartialDownload()) | 353 if (download->IsPartialDownload()) |
| 354 download->Cancel(true); | 354 download->Cancel(); |
| 355 download->Delete(DownloadItem::DELETE_DUE_TO_USER_DISCARD); | 355 download->Delete(DownloadItem::DELETE_DUE_TO_USER_DISCARD); |
| 356 // WARNING: we are deleted at this point. Don't access 'this'. | 356 // WARNING: we are deleted at this point. Don't access 'this'. |
| 357 } | 357 } |
| 358 | 358 |
| 359 | 359 |
| 360 // Sets the enabled and checked state of a particular menu item for this | 360 // Sets the enabled and checked state of a particular menu item for this |
| 361 // download. We translate the NSMenuItem selection to menu selections understood | 361 // download. We translate the NSMenuItem selection to menu selections understood |
| 362 // by the non platform specific download context menu. | 362 // by the non platform specific download context menu. |
| 363 - (BOOL)validateMenuItem:(NSMenuItem *)item { | 363 - (BOOL)validateMenuItem:(NSMenuItem *)item { |
| 364 SEL action = [item action]; | 364 SEL action = [item action]; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 [sender setTitle:l10n_util::GetNSStringWithFixup( | 410 [sender setTitle:l10n_util::GetNSStringWithFixup( |
| 411 IDS_DOWNLOAD_MENU_PAUSE_ITEM)]; | 411 IDS_DOWNLOAD_MENU_PAUSE_ITEM)]; |
| 412 } else { | 412 } else { |
| 413 [sender setTitle:l10n_util::GetNSStringWithFixup( | 413 [sender setTitle:l10n_util::GetNSStringWithFixup( |
| 414 IDS_DOWNLOAD_MENU_RESUME_ITEM)]; | 414 IDS_DOWNLOAD_MENU_RESUME_ITEM)]; |
| 415 } | 415 } |
| 416 menuBridge_->ExecuteCommand(DownloadShelfContextMenuMac::TOGGLE_PAUSE); | 416 menuBridge_->ExecuteCommand(DownloadShelfContextMenuMac::TOGGLE_PAUSE); |
| 417 } | 417 } |
| 418 | 418 |
| 419 @end | 419 @end |
| OLD | NEW |