Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(582)

Side by Side Diff: chrome/browser/ui/cocoa/download/download_item_controller.mm

Issue 7796014: Make cancel remove cancelled download from active queues at time of cancel. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix to try to get past main waterfall failure. Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « chrome/browser/download/download_manager_unittest.cc ('k') | chrome/browser/ui/gtk/download/download_item_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698