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

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

Issue 533883002: [Mac] Re-layout download shelf when danger state of item changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add tests Created 6 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
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/strings/string16.h" 10 #include "base/strings/string16.h"
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 NSPoint frameOrigin = [dangerousButtonTweaker_ frame].origin; 203 NSPoint frameOrigin = [dangerousButtonTweaker_ frame].origin;
204 frameOrigin.x += labelWidthChange; 204 frameOrigin.x += labelWidthChange;
205 [dangerousButtonTweaker_ setFrameOrigin:frameOrigin]; 205 [dangerousButtonTweaker_ setFrameOrigin:frameOrigin];
206 206
207 [dangerousButtonTweaker_ setHidden:NO]; 207 [dangerousButtonTweaker_ setHidden:NO];
208 [maliciousButtonTweaker_ setHidden:YES]; 208 [maliciousButtonTweaker_ setHidden:YES];
209 } 209 }
210 DCHECK(alertIcon); 210 DCHECK(alertIcon);
211 [image_ setImage:alertIcon]; 211 [image_ setImage:alertIcon];
212 212
213 // Grow the parent views
214 WidenView([self view], labelWidthChange + buttonWidthChange);
215 WidenView(dangerousDownloadView_, labelWidthChange + buttonWidthChange); 213 WidenView(dangerousDownloadView_, labelWidthChange + buttonWidthChange);
214 [shelf_ layoutItems];
216 } 215 }
217 216
218 - (void)setStateFromDownload:(DownloadItemModel*)downloadModel { 217 - (void)setStateFromDownload:(DownloadItemModel*)downloadModel {
219 DCHECK_EQ([self download], downloadModel->download()); 218 DCHECK_EQ([self download], downloadModel->download());
220 219
221 // Handle dangerous downloads. 220 // Handle dangerous downloads.
222 if (downloadModel->IsDangerous()) { 221 if (downloadModel->IsDangerous()) {
223 [self showDangerousWarning:downloadModel]; 222 [self showDangerousWarning:downloadModel];
224 return; 223 return;
225 } 224 }
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 base::scoped_nsobject<DownloadShelfContextMenuController> menuController( 364 base::scoped_nsobject<DownloadShelfContextMenuController> menuController(
366 [[DownloadShelfContextMenuController alloc] 365 [[DownloadShelfContextMenuController alloc]
367 initWithItemController:self 366 initWithItemController:self
368 withDelegate:nil]); 367 withDelegate:nil]);
369 [NSMenu popUpContextMenu:[menuController menu] 368 [NSMenu popUpContextMenu:[menuController menu]
370 withEvent:[NSApp currentEvent] 369 withEvent:[NSApp currentEvent]
371 forView:[self view]]; 370 forView:[self view]];
372 } 371 }
373 372
374 @end 373 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698