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

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

Issue 14947007: [Downloads] Allow acquiring dangerous download file. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 7 years, 6 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/bundle_locations.h" 7 #include "base/mac/bundle_locations.h"
8 #include "base/mac/mac_util.h" 8 #include "base/mac/mac_util.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/string16.h" 10 #include "base/string16.h"
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 themeProvider->GetNSColor(ThemeProperties::COLOR_TAB_TEXT, true); 299 themeProvider->GetNSColor(ThemeProperties::COLOR_TAB_TEXT, true);
300 [dangerousDownloadLabel_ setTextColor:color]; 300 [dangerousDownloadLabel_ setTextColor:color];
301 } 301 }
302 302
303 - (IBAction)saveDownload:(id)sender { 303 - (IBAction)saveDownload:(id)sender {
304 // The user has confirmed a dangerous download. We record how quickly the 304 // The user has confirmed a dangerous download. We record how quickly the
305 // user did this to detect whether we're being clickjacked. 305 // user did this to detect whether we're being clickjacked.
306 UMA_HISTOGRAM_LONG_TIMES("clickjacking.save_download", 306 UMA_HISTOGRAM_LONG_TIMES("clickjacking.save_download",
307 base::Time::Now() - creationTime_); 307 base::Time::Now() - creationTime_);
308 // This will change the state and notify us. 308 // This will change the state and notify us.
309 bridge_->download_model()->download()->DangerousDownloadValidated(); 309 bridge_->download_model()->download()->ValidateDangerousDownload();
310 } 310 }
311 311
312 - (IBAction)discardDownload:(id)sender { 312 - (IBAction)discardDownload:(id)sender {
313 UMA_HISTOGRAM_LONG_TIMES("clickjacking.discard_download", 313 UMA_HISTOGRAM_LONG_TIMES("clickjacking.discard_download",
314 base::Time::Now() - creationTime_); 314 base::Time::Now() - creationTime_);
315 DownloadItem* download = bridge_->download_model()->download(); 315 DownloadItem* download = bridge_->download_model()->download();
316 if (download->IsPartialDownload()) 316 download->Remove();
317 download->Cancel(true);
318 download->Delete(DownloadItem::DELETE_DUE_TO_USER_DISCARD);
319 // WARNING: we are deleted at this point. Don't access 'this'. 317 // WARNING: we are deleted at this point. Don't access 'this'.
320 } 318 }
321 319
322 320
323 // Sets the enabled and checked state of a particular menu item for this 321 // Sets the enabled and checked state of a particular menu item for this
324 // download. We translate the NSMenuItem selection to menu selections understood 322 // download. We translate the NSMenuItem selection to menu selections understood
325 // by the non platform specific download context menu. 323 // by the non platform specific download context menu.
326 - (BOOL)validateMenuItem:(NSMenuItem *)item { 324 - (BOOL)validateMenuItem:(NSMenuItem *)item {
327 SEL action = [item action]; 325 SEL action = [item action];
328 326
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 [sender setTitle:l10n_util::GetNSStringWithFixup( 371 [sender setTitle:l10n_util::GetNSStringWithFixup(
374 IDS_DOWNLOAD_MENU_PAUSE_ITEM)]; 372 IDS_DOWNLOAD_MENU_PAUSE_ITEM)];
375 } else { 373 } else {
376 [sender setTitle:l10n_util::GetNSStringWithFixup( 374 [sender setTitle:l10n_util::GetNSStringWithFixup(
377 IDS_DOWNLOAD_MENU_RESUME_ITEM)]; 375 IDS_DOWNLOAD_MENU_RESUME_ITEM)];
378 } 376 }
379 menuBridge_->ExecuteCommand(DownloadShelfContextMenuMac::TOGGLE_PAUSE, 0); 377 menuBridge_->ExecuteCommand(DownloadShelfContextMenuMac::TOGGLE_PAUSE, 0);
380 } 378 }
381 379
382 @end 380 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698