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

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

Issue 431019: Fix to prevent selecting a popup menu item from crashing when the item is aut... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 1 month 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/cocoa/download_item_controller.h" 5 #import "chrome/browser/cocoa/download_item_controller.h"
6 6
7 #include "app/gfx/text_elider.h" 7 #include "app/gfx/text_elider.h"
8 #include "app/l10n_util_mac.h" 8 #include "app/l10n_util_mac.h"
9 #include "app/resource_bundle.h" 9 #include "app/resource_bundle.h"
10 #include "base/mac_util.h" 10 #include "base/mac_util.h"
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 } 196 }
197 197
198 - (IBAction)handleButtonClick:(id)sender { 198 - (IBAction)handleButtonClick:(id)sender {
199 if ([cell_ isButtonPartPressed]) { 199 if ([cell_ isButtonPartPressed]) {
200 DownloadItem* download = bridge_->download_model()->download(); 200 DownloadItem* download = bridge_->download_model()->download();
201 if (download->state() == DownloadItem::IN_PROGRESS) 201 if (download->state() == DownloadItem::IN_PROGRESS)
202 download->set_open_when_complete(!download->open_when_complete()); 202 download->set_open_when_complete(!download->open_when_complete());
203 else if (download->state() == DownloadItem::COMPLETE) 203 else if (download->state() == DownloadItem::COMPLETE)
204 download_util::OpenDownload(download); 204 download_util::OpenDownload(download);
205 } else { 205 } else {
206 // Hold a reference in case the download completes and we're auto-removed.
pink (ping after 24hrs) 2009/11/24 15:06:02 expand on what "auto-removing" is.
207 scoped_nsobject<DownloadItemController> ref([self retain]);
206 [NSMenu popUpContextMenu:currentMenu_ 208 [NSMenu popUpContextMenu:currentMenu_
207 withEvent:[NSApp currentEvent] 209 withEvent:[NSApp currentEvent]
208 forView:progressView_]; 210 forView:progressView_];
209 } 211 }
210 } 212 }
211 213
212 - (NSSize)preferredSize { 214 - (NSSize)preferredSize {
213 if (state_ == kNormal) 215 if (state_ == kNormal)
214 return [progressView_ frame].size; 216 return [progressView_ frame].size;
215 DCHECK_EQ(kDangerous, state_); 217 DCHECK_EQ(kDangerous, state_);
216 return [dangerousDownloadView_ frame].size; 218 return [dangerousDownloadView_ frame].size;
217 } 219 }
218 220
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 320
319 - (IBAction)handleReveal:(id)sender { 321 - (IBAction)handleReveal:(id)sender {
320 menuBridge_->ExecuteItemCommand(DownloadShelfContextMenuMac::SHOW_IN_FOLDER); 322 menuBridge_->ExecuteItemCommand(DownloadShelfContextMenuMac::SHOW_IN_FOLDER);
321 } 323 }
322 324
323 - (IBAction)handleCancel:(id)sender { 325 - (IBAction)handleCancel:(id)sender {
324 menuBridge_->ExecuteItemCommand(DownloadShelfContextMenuMac::CANCEL); 326 menuBridge_->ExecuteItemCommand(DownloadShelfContextMenuMac::CANCEL);
325 } 327 }
326 328
327 @end 329 @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