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