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

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

Issue 10543033: Retain the controller in -[DownloadItemButton rightMouseDown:] before opening the menu that targets… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_button.h" 5 #import "chrome/browser/ui/cocoa/download/download_item_button.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/sys_string_conversions.h" 8 #include "base/sys_string_conversions.h"
9 #import "chrome/browser/ui/cocoa/download/download_item_cell.h" 9 #import "chrome/browser/ui/cocoa/download/download_item_cell.h"
10 #import "chrome/browser/ui/cocoa/download/download_item_controller.h" 10 #import "chrome/browser/ui/cocoa/download/download_item_controller.h"
(...skipping 25 matching lines...) Expand all
36 // represent a file that's auto-removed (e.g. a theme). 36 // represent a file that's auto-removed (e.g. a theme).
37 scoped_nsobject<DownloadItemController> ref([controller_ retain]); 37 scoped_nsobject<DownloadItemController> ref([controller_ retain]);
38 [cell setHighlighted:YES]; 38 [cell setHighlighted:YES];
39 [[self menu] setDelegate:self]; 39 [[self menu] setDelegate:self];
40 [NSMenu popUpContextMenu:[self menu] 40 [NSMenu popUpContextMenu:[self menu]
41 withEvent:[NSApp currentEvent] 41 withEvent:[NSApp currentEvent]
42 forView:self]; 42 forView:self];
43 } 43 }
44 } 44 }
45 45
46 // Override to retain the controller, in case a closure is pumped that deletes
47 // the DownloadItemController while the menu is open <http://crbug.com/129826>.
48 - (void)rightMouseDown:(NSEvent*)event {
49 scoped_nsobject<DownloadItemController> ref([controller_ retain]);
50 [super rightMouseDown:event];
51 }
52
46 - (void)menuDidClose:(NSMenu*)menu { 53 - (void)menuDidClose:(NSMenu*)menu {
47 [[self cell] setHighlighted:NO]; 54 [[self cell] setHighlighted:NO];
48 } 55 }
49 56
50 - (BOOL)shouldDelayWindowOrderingForEvent:(NSEvent*)event { 57 - (BOOL)shouldDelayWindowOrderingForEvent:(NSEvent*)event {
51 return YES; 58 return YES;
52 } 59 }
53 60
54 @end 61 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698