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

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

Issue 2688413012: Don't animate the download shelf when entering/exiting fullscreen. (Closed)
Patch Set: Try fixing a 10.9 test; ignore this patchset for the moment Created 3 years, 10 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_shelf_controller.h" 5 #import "chrome/browser/ui/cocoa/download/download_shelf_controller.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/mac/bundle_locations.h" 9 #include "base/mac/bundle_locations.h"
10 #include "base/strings/sys_string_conversions.h" 10 #include "base/strings/sys_string_conversions.h"
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 } 220 }
221 } 221 }
222 222
223 - (void)downloadWasOpened:(DownloadItemController*)item_controller { 223 - (void)downloadWasOpened:(DownloadItemController*)item_controller {
224 // This should only be called on the main thead. 224 // This should only be called on the main thead.
225 DCHECK([NSThread isMainThread]); 225 DCHECK([NSThread isMainThread]);
226 [self maybeAutoCloseAfterDelay]; 226 [self maybeAutoCloseAfterDelay];
227 } 227 }
228 228
229 - (void)showDownloadShelf:(BOOL)show 229 - (void)showDownloadShelf:(BOOL)show
230 isUserAction:(BOOL)isUserAction { 230 isUserAction:(BOOL)isUserAction
231 animate:(BOOL)animate {
231 [self cancelAutoClose]; 232 [self cancelAutoClose];
232 shouldCloseOnMouseExit_ = NO; 233 shouldCloseOnMouseExit_ = NO;
233 234
234 if ([self isVisible] == show) 235 if ([self isVisible] == show)
235 return; 236 return;
236 237
237 if (!show) { 238 if (!show) {
238 int numInProgress = 0; 239 int numInProgress = 0;
239 for (NSUInteger i = 0; i < [downloadItemControllers_ count]; ++i) { 240 for (NSUInteger i = 0; i < [downloadItemControllers_ count]; ++i) {
240 DownloadItem* item = [[downloadItemControllers_ objectAtIndex:i]download]; 241 DownloadItem* item = [[downloadItemControllers_ objectAtIndex:i]download];
241 if (item->GetState() == DownloadItem::IN_PROGRESS) 242 if (item->GetState() == DownloadItem::IN_PROGRESS)
242 ++numInProgress; 243 ++numInProgress;
243 } 244 }
244 RecordDownloadShelfClose( 245 RecordDownloadShelfClose(
245 [downloadItemControllers_ count], numInProgress, !isUserAction); 246 [downloadItemControllers_ count], numInProgress, !isUserAction);
246 } 247 }
247 248
248 // Animate the shelf out, but not in. 249 // Animate the shelf out, but not in.
249 // TODO(rohitrao): We do not animate on the way in because Cocoa is already 250 // TODO(rohitrao): We do not animate on the way in because Cocoa is already
250 // doing a lot of work to set up the download arrow animation. I've chosen to 251 // doing a lot of work to set up the download arrow animation. I've chosen to
251 // do no animation over janky animation. Find a way to make animating in 252 // do no animation over janky animation. Find a way to make animating in
252 // smoother. 253 // smoother.
Nico 2017/02/17 15:53:46 maybe we can reconsider this now that machines are
Sidney San Martín 2017/02/17 16:07:08 I am 100% planning to do this when I get back to m
253 AnimatableView* view = [self animatableView]; 254 AnimatableView* view = [self animatableView];
254 if (show) { 255 if (animate && !show) {
255 [view setHeight:maxShelfHeight_]; 256 [view animateToNewHeight:0 duration:kDownloadShelfCloseDuration];
256 [view setHidden:NO];
257 } else { 257 } else {
258 [view animateToNewHeight:0 duration:kDownloadShelfCloseDuration]; 258 [view setHeight:show ? maxShelfHeight_ : 0];
259 [view setHidden:!show];
259 } 260 }
260 261
261 barIsVisible_ = show; 262 barIsVisible_ = show;
262 [self updateCloseButton]; 263 [self updateCloseButton];
263 } 264 }
264 265
265 - (DownloadShelf*)bridge { 266 - (DownloadShelf*)bridge {
266 return bridge_.get(); 267 return bridge_.get();
267 } 268 }
268 269
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 } 507 }
507 508
508 // Set the tracking off to create a new tracking area for the control. 509 // Set the tracking off to create a new tracking area for the control.
509 // When changing the bounds/frame on a HoverButton, the tracking isn't updated 510 // When changing the bounds/frame on a HoverButton, the tracking isn't updated
510 // correctly, it needs to be turned off and back on. 511 // correctly, it needs to be turned off and back on.
511 [hoverCloseButton_ setTrackingEnabled:NO]; 512 [hoverCloseButton_ setTrackingEnabled:NO];
512 [hoverCloseButton_ setFrame:bounds]; 513 [hoverCloseButton_ setFrame:bounds];
513 [hoverCloseButton_ setTrackingEnabled:YES]; 514 [hoverCloseButton_ setTrackingEnabled:YES];
514 } 515 }
515 @end 516 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698